# HG changeset patch # User nemo # Date 1342824484 14400 # Node ID fd91aa100ce0674718a9a87de67780f51a22b0d4 # Parent 38d369c59d51e2649fad8d43e4913774917d2cab Avoid desync playing back demos diff -r 38d369c59d51 -r fd91aa100ce0 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Fri Jul 20 17:43:35 2012 -0400 +++ b/hedgewars/uCommandHandlers.pas Fri Jul 20 18:48:04 2012 -0400 @@ -792,13 +792,13 @@ RegisterVariable('-up' , @chUp_m , false, true); RegisterVariable('+left' , @chLeft_p , false, true); RegisterVariable('-left' , @chLeft_m , false, true); - RegisterVariable('+attack' , @chAttack_p , false, true); + RegisterVariable('+attack' , @chAttack_p , false, false); // WTF? RegisterVariable('+down' , @chDown_p , false, true); RegisterVariable('-down' , @chDown_m , false, true); RegisterVariable('hjump' , @chHJump , false, true); RegisterVariable('ljump' , @chLJump , false, true); RegisterVariable('nextturn', @chNextTurn , false, true); - RegisterVariable('-attack' , @chAttack_m , false, true); + RegisterVariable('-attack' , @chAttack_m , false, false); RegisterVariable('slot' , @chSlot , false, true); RegisterVariable('setweap' , @chSetWeapon , false, true); //////// End top by freq analysis diff -r 38d369c59d51 -r fd91aa100ce0 hedgewars/uCommands.pas --- a/hedgewars/uCommands.pas Fri Jul 20 17:43:35 2012 -0400 +++ b/hedgewars/uCommands.pas Fri Jul 20 18:48:04 2012 -0400 @@ -27,7 +27,7 @@ procedure initModule; procedure freeModule; -procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Synced: boolean); +procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean); procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean); procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); procedure ParseTeamCommand(s: shortstring); @@ -41,7 +41,7 @@ Next: PVariable; Name: string[15]; Handler: TCommandHandler; - Trusted, Synced: boolean; + Trusted, Rand: boolean; end; var @@ -51,7 +51,7 @@ begin RegisterVariable(Name, p, Trusted, false); end; -procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Synced: boolean); +procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean); var value: PVariable; begin @@ -61,7 +61,7 @@ value^.Name:= Name; value^.Handler:= p; value^.Trusted:= Trusted; -value^.Synced:= Synced; +value^.Rand:= Rand; if Variables = nil then Variables:= value @@ -93,7 +93,7 @@ begin if t^.Name = CmdStr then begin - if t^.Synced then CheckSum:= CheckSum xor LongWord(SDLNet_Read32(@CmdStr)) xor LongWord(s[0]) xor GameTicks; + if t^.Rand then CheckSum:= CheckSum xor LongWord(SDLNet_Read32(@CmdStr)) xor LongWord(s[0]) xor GameTicks; if TrustedSource or t^.Trusted then t^.Handler(s); exit diff -r 38d369c59d51 -r fd91aa100ce0 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Fri Jul 20 17:43:35 2012 -0400 +++ b/hedgewars/uGearsHedgehog.pas Fri Jul 20 18:48:04 2012 -0400 @@ -619,7 +619,7 @@ else begin // Add spawning here... - AddRandomness(CheckSum xor GameTicks); + AddRandomness(GameTicks); gi := GearsList; while gi <> nil do