hedgewars/uGears.pas
changeset 4207 31e77dcf18fe
parent 4198 55814f1ef60a
child 4208 dd54999c2822
--- 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;