hedgewars/uIO.pas
changeset 11483 dbc0d54798dc
parent 11363 9006e158a81f
child 11507 bd9a2f1b0080
--- a/hedgewars/uIO.pas	Fri Jan 01 19:34:48 2016 -0500
+++ b/hedgewars/uIO.pas	Mon Jan 04 10:08:26 2016 +0300
@@ -72,22 +72,31 @@
 function AddCmd(Time: Word; str: shortstring): PCmd;
 var command: PCmd;
 begin
-new(command);
-FillChar(command^, sizeof(TCmd), 0);
-command^.loTime:= Time;
-command^.str:= str;
-if (command^.cmd <> 'F') and (command^.cmd <> 'G') then dec(command^.len, 2); // cut timestamp
-if headcmd = nil then
+    if (lastcmd <> nil) and (lastcmd^.cmd = '+') then
+    begin
+        command:= lastcmd;
+    end else
     begin
-    headcmd:= command;
-    lastcmd:= command
-    end
-else
-    begin
-    lastcmd^.Next:= command;
-    lastcmd:= command
+        new(command);
+
+        if headcmd = nil then
+            begin
+            headcmd:= command;
+            lastcmd:= command
+            end
+        else
+            begin
+            lastcmd^.Next:= command;
+            lastcmd:= command
+            end;
     end;
-AddCmd:= command;
+
+    FillChar(command^, sizeof(TCmd), 0);
+    command^.loTime:= Time;
+    command^.str:= str;
+    if (command^.cmd <> 'F') and (command^.cmd <> 'G') then dec(command^.len, 2); // cut timestamp
+
+    AddCmd:= command;
 end;
 
 procedure RemoveCmd;