hedgewars/uCommandHandlers.pas
changeset 7103 1c1afb5a1565
parent 7068 b1b7eb9c8cc9
child 7104 2468316c1d9d
--- a/hedgewars/uCommandHandlers.pas	Mon May 21 06:34:17 2012 +0200
+++ b/hedgewars/uCommandHandlers.pas	Tue May 22 00:29:32 2012 +0400
@@ -412,12 +412,23 @@
 end;
 
 procedure chNextTurn(var s: shortstring);
+var checksum: Longword;
 begin
     s:= s; // avoid compiler hint
+
     TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
 
+    checksum:= GameTicks;
+
     if not CurrentTeam^.ExtDriven then
-        SendIPC(_S'N');
+        begin
+        s[0]:= #5;
+        s[1]:= 'N';
+        SDLNet_Write32(checksum, @s[2]);
+        SendIPC(s)
+        end
+    else
+        TryDo(checksum = lastTurnChecksum, 'Desync detected', true);
     AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));
 end;