# HG changeset patch
# User nemo
# Date 1362517462 18000
# Node ID 9fa380a18a6527b4a00b44d514a8b82b5669b96e
# Parent  f523e5e84772356deaa003d8a332dc10e978bfa0
At multiple requests, change ice to be turn based.  This is a more modest adjustment of existing code, that can be fairly easily flagged or reverted if desired.  It also allows scripts to extend freezing, and preserves fire melting.

diff -r f523e5e84772 -r 9fa380a18a65 QTfrontend/weapons.h
--- a/QTfrontend/weapons.h	Tue Mar 05 09:11:28 2013 +0100
+++ b/QTfrontend/weapons.h	Tue Mar 05 16:04:22 2013 -0500
@@ -28,7 +28,7 @@
 
 #define AMMOLINE_CRAZY_QT       "9999999999999999992999999999999999299999999909999992999"
 #define AMMOLINE_CRAZY_PROB     "1111110111111111111111111111111111111111111101111111111"
-#define AMMOLINE_CRAZY_DELAY    "0000000000000000000000000000000000000000000000000000020"
+#define AMMOLINE_CRAZY_DELAY    "0000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_CRAZY_CRATE    "1311110312111111123114111111111111111211110101111111121"
 
 #define AMMOLINE_PROMODE_QT     "9090009000000000000009000000000000000000000000000000000"
@@ -38,7 +38,7 @@
 
 #define AMMOLINE_SHOPPA_QT      "0000009900000000000000000000000000000000000000000000000"
 #define AMMOLINE_SHOPPA_PROB    "4444410044244402210112121222422000000002000400010011001"
-#define AMMOLINE_SHOPPA_DELAY   "0000000000000000000000000000000000000000000000000000020"
+#define AMMOLINE_SHOPPA_DELAY   "0000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_SHOPPA_CRATE   "1111110111111111111111111111111111111111101101111111121"
 
 #define AMMOLINE_CLEAN_QT       "1010009000010000011000000000000000000000000000001000000"
diff -r f523e5e84772 -r 9fa380a18a65 hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Tue Mar 05 09:11:28 2013 +0100
+++ b/hedgewars/GSHandlers.inc	Tue Mar 05 16:04:22 2013 -0500
@@ -5201,7 +5201,7 @@
                                 if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] < 256 then
                                     hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] := hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] + 1
                                 else if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] = 256 then
-                                    hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= cHedgehogTurnTime + cReadyDelay
+                                    hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 150000;//cHedgehogTurnTime + cReadyDelay
                                 end;
                 inc(Pos)
             end
diff -r f523e5e84772 -r 9fa380a18a65 hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Tue Mar 05 09:11:28 2013 +0100
+++ b/hedgewars/uGearsHedgehog.pas	Tue Mar 05 16:04:22 2013 -0500
@@ -1260,6 +1260,7 @@
     exit
     end;
 if GameTicks mod 100 = 0 then CheckIce(Gear);
+(*
 if Gear^.Hedgehog^.Effects[heFrozen] > 0 then 
     begin
     if (Gear^.Hedgehog^.Effects[heFrozen] > 256) and (CurrentHedgehog^.Team^.Clan <> Gear^.Hedgehog^.Team^.Clan) then
@@ -1267,6 +1268,9 @@
     else if GameTicks mod 10 = 0 then
         dec(Gear^.Hedgehog^.Effects[heFrozen])
     end;
+*)
+if (GameTicks mod 10 = 0) and (Gear^.Hedgehog^.Effects[heFrozen] > 0) and (Gear^.Hedgehog^.Effects[heFrozen] < 256) then 
+    dec(Gear^.Hedgehog^.Effects[heFrozen]);
 if (Gear^.State and gstHHDriven) = 0 then
     doStepHedgehogFree(Gear)
 else
diff -r f523e5e84772 -r 9fa380a18a65 hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Tue Mar 05 09:11:28 2013 +0100
+++ b/hedgewars/uTeams.pas	Tue Mar 05 16:04:22 2013 -0500
@@ -110,7 +110,7 @@
 end;
 
 procedure SwitchHedgehog;
-var c: LongWord;
+var c, i, j: LongWord;
     PrevHH, PrevTeam : LongWord;
 begin
 TargetPoint.X:= NoPointX;
@@ -173,7 +173,15 @@
     if c = ClansCount then
         begin
         if not PlacingHogs then
+            begin
             inc(TotalRounds);
+            for i:= 0 to Pred(TeamsCount) do
+                with TeamsArray[i]^ do
+                    for j:= 0 to Pred(HedgehogsNumber) do
+                        with Hedgehogs[j] do
+                            if Effects[heFrozen] > 255 then
+                                Effects[heFrozen]:= max(255,Effects[heFrozen]-50000)
+            end;
         c:= 0
         end;