hedgewars/uGears.pas
changeset 8349 a1dbe148f10f
parent 8204 9a6030d96273
child 8351 f895be37b607
--- a/hedgewars/uGears.pas	Sun Dec 30 03:00:51 2012 +0100
+++ b/hedgewars/uGears.pas	Tue Jan 01 14:21:51 2013 -0500
@@ -78,6 +78,7 @@
     stSpawn, stNTurn);
     upd: Longword;
     snowLeft,snowRight: LongInt;
+    NewTurnTick: LongWord;
     //SDMusic: shortstring;
 
 // For better maintainability the step handlers of gears are stored in
@@ -189,6 +190,10 @@
     i, AliveCount: LongInt;
     s: shortstring;
 begin
+ScriptCall('onGameTick');
+if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
+if GameTicks = NewTurnTick then ScriptCall('onNewTurn');
+
 PrvInactive:= AllInactive;
 AllInactive:= true;
 
@@ -383,7 +388,8 @@
                 SwitchHedgehog;
 
                 AfterSwitchHedgehog;
-                bBetweenTurns:= false
+                bBetweenTurns:= false;
+                NewTurnTick:= GameTicks + 1
                 end;
             step:= Low(step)
             end;
@@ -470,8 +476,6 @@
         inc(hiTicks) // we do not recieve a message for this
     end;
 AddRandomness(CheckSum);
-ScriptCall('onGameTick');
-if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
 
 inc(GameTicks)
 end;
@@ -1396,6 +1400,7 @@
     upd:= 0;
 
     //SDMusic:= 'hell.ogg';
+    NewTurnTick:= $FFFFFFFF;
 end;
 
 procedure freeModule;