--- 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;
--- a/hedgewars/uIO.pas Mon May 21 06:34:17 2012 +0200
+++ b/hedgewars/uIO.pas Tue May 22 00:29:32 2012 +0400
@@ -318,6 +318,7 @@
'F': ParseCommand('teamgone ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
'N': begin
tmpflag:= false;
+ lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]);
AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
end;
'p': begin
--- a/hedgewars/uVariables.pas Mon May 21 06:34:17 2012 +0200
+++ b/hedgewars/uVariables.pas Tue May 22 00:29:32 2012 +0400
@@ -2461,6 +2461,8 @@
DefaultBinds : TBinds;
+ lastTurnChecksum : Longword;
+
var trammo: array[TAmmoStrId] of ansistring; // name of the weapon
trammoc: array[TAmmoStrId] of ansistring; // caption of the weapon
trammod: array[TAmmoStrId] of ansistring; // description of the weapon