hedgewars/uGears.pas
branchflibqtfrontend
changeset 8363 0b4ac686fc44
parent 8351 f895be37b607
child 8425 4f226963faef
--- a/hedgewars/uGears.pas	Tue Dec 18 20:48:37 2012 +0400
+++ b/hedgewars/uGears.pas	Fri Jan 04 21:44:40 2013 +0400
@@ -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,16 @@
     i, AliveCount: LongInt;
     s: shortstring;
 begin
+ScriptCall('onGameTick');
+if GameTicks mod 20 = 0 then ScriptCall('onGameTick20');
+if GameTicks = NewTurnTick then
+    begin
+    ScriptCall('onNewTurn');
+{$IFDEF SDL13}
+    uTouch.NewTurnBeginning();
+{$ENDIF}
+    end;
+
 PrvInactive:= AllInactive;
 AllInactive:= true;
 
@@ -383,7 +394,8 @@
                 SwitchHedgehog;
 
                 AfterSwitchHedgehog;
-                bBetweenTurns:= false
+                bBetweenTurns:= false;
+                NewTurnTick:= GameTicks + 1
                 end;
             step:= Low(step)
             end;
@@ -470,8 +482,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 +1406,7 @@
     upd:= 0;
 
     //SDMusic:= 'hell.ogg';
+    NewTurnTick:= $FFFFFFFF;
 end;
 
 procedure freeModule;