better end of turn in infinite attack mode. NEEDS TESTING.
authornemo
Sun, 07 Nov 2010 17:40:55 -0500
changeset 4207 31e77dcf18fe
parent 4206 85ff4cce27c6
child 4208 dd54999c2822
better end of turn in infinite attack mode. NEEDS TESTING.
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sun Nov 07 17:03:10 2010 -0500
+++ b/hedgewars/uGears.pas	Sun Nov 07 17:40:55 2010 -0500
@@ -724,7 +724,7 @@
             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
             stSpawn, stNTurn) = stDelay;
 var Gear, t: PGear;
-    i: LongInt;
+    i, AliveCount: LongInt;
     s: shortstring;
 begin
 PrvInactive:= AllInactive;
@@ -879,7 +879,15 @@
             begin
             SweepDirty;
             CheckNoDamage;
-            CheckForWin
+            AliveCount:= 0; // shorter version of check for win to allow typical step activity to proceed
+            for i:= 0 to Pred(ClansCount) do
+                if ClansArray[i]^.ClanHealth > 0 then inc(AliveCount);
+            if (AliveCount <= 1) and ((GameFlags and gfOneClanMode) = 0) then
+                begin
+                step:= stChDmg;
+                GameFlags:= GameFlags and not gfInfAttack;
+                TurnTimeLeft:= 0
+                end
             end
         end
     end;