Fix regression introduced by previous commit
authorunc0rr
Tue, 03 Jul 2007 14:47:33 +0000
changeset 548 ac1e32b538fd
parent 547 b81a055f2d06
child 549 4278a80140a8
Fix regression introduced by previous commit
hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Mon Jul 02 21:33:21 2007 +0000
+++ b/hedgewars/uTeams.pas	Tue Jul 03 14:47:33 2007 +0000
@@ -85,12 +85,21 @@
 function CheckForWin: boolean;
 var team, AliveTeam: PTeam;
     s: shortstring;
+    t, AliveCount: LongInt;
 begin
-if TeamsCount >= 2 then exit(false);
+AliveCount:= 0;
+for t:= 0 to Pred(TeamsCount) do
+    if TeamsArray[t]^.TeamHealth > 0 then
+       begin
+       inc(AliveCount);
+       AliveTeam:= TeamsArray[t]
+       end;
+
+if AliveCount >= 2 then exit(false);
 CheckForWin:= true;
 
 TurnTimeLeft:= 0;
-if TeamsCount = 0 then
+if AliveCount = 0 then
    begin // draw
    AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState);
    SendStat(siGameResult, trmsg[sidDraw]);