workaround for frequent AllHH active call in hedgehog step icegun
authornemo
Mon, 25 Feb 2013 12:54:50 -0500
branchicegun
changeset 8576 286ebfcb3d97
parent 8574 684169401a2f
child 8578 d2bfe0683b9a
workaround for frequent AllHH active call in hedgehog step
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGears.pas	Mon Feb 25 12:29:39 2013 -0500
+++ b/hedgewars/uGears.pas	Mon Feb 25 12:54:50 2013 -0500
@@ -46,7 +46,8 @@
 procedure ProcessGears;
 procedure EndTurnCleanup;
 procedure SetAllToActive;
-procedure SetAllHHToActive;
+procedure SetAllHHToActive; inline;
+procedure SetAllHHToActive(Ice: boolean);
 procedure DrawGears;
 procedure FreeGearsList;
 procedure AddMiscGears;
@@ -561,7 +562,12 @@
     end
 end;
 
-procedure SetAllHHToActive;
+procedure SetAllHHToActive; inline;
+begin
+SetAllHHToActive(true)
+end;
+
+procedure SetAllHHToActive(Ice: boolean);
 var t: PGear;
 begin
 AllInactive:= false;
@@ -570,14 +576,13 @@
     begin
     if (t^.Kind = gtHedgehog) or (t^.Kind = gtExplosives) then
         begin
-        if t^.Kind = gtHedgehog then CheckIce(t);
+        if (t^.Kind = gtHedgehog) and Ice then CheckIce(t);
         t^.Active:= true
         end;
     t:= t^.NextGear
     end
 end;
 
-
 procedure DrawGears;
 var Gear: PGear;
     x, y: LongInt;
--- a/hedgewars/uGearsHedgehog.pas	Mon Feb 25 12:29:39 2013 -0500
+++ b/hedgewars/uGearsHedgehog.pas	Mon Feb 25 12:54:50 2013 -0500
@@ -779,7 +779,7 @@
     if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) then
         MakeHedgehogsStep(Gear);
 
-    SetAllHHToActive;
+    SetAllHHToActive(false);
     AddGearCI(Gear)
     end
 end;
@@ -1257,7 +1257,7 @@
     DeleteGear(Gear);
     exit
     end;
-if (GameTicks mod (100*LongWord(hwRound(cMaxWindSpeed*2/cGravity))) = 0) then CheckIce(Gear);
+if GameTicks mod 100 = 0 then CheckIce(Gear);
 if Gear^.Hedgehog^.Effects[heFrozen] > 0 then 
     begin
     if Gear^.Hedgehog^.Effects[heFrozen] > 256 then