hedgewars/uTeams.pas
changeset 548 ac1e32b538fd
parent 547 b81a055f2d06
child 549 4278a80140a8
equal deleted inserted replaced
547:b81a055f2d06 548:ac1e32b538fd
    83 procedure FreeTeamsList; forward;
    83 procedure FreeTeamsList; forward;
    84 
    84 
    85 function CheckForWin: boolean;
    85 function CheckForWin: boolean;
    86 var team, AliveTeam: PTeam;
    86 var team, AliveTeam: PTeam;
    87     s: shortstring;
    87     s: shortstring;
    88 begin
    88     t, AliveCount: LongInt;
    89 if TeamsCount >= 2 then exit(false);
    89 begin
       
    90 AliveCount:= 0;
       
    91 for t:= 0 to Pred(TeamsCount) do
       
    92     if TeamsArray[t]^.TeamHealth > 0 then
       
    93        begin
       
    94        inc(AliveCount);
       
    95        AliveTeam:= TeamsArray[t]
       
    96        end;
       
    97 
       
    98 if AliveCount >= 2 then exit(false);
    90 CheckForWin:= true;
    99 CheckForWin:= true;
    91 
   100 
    92 TurnTimeLeft:= 0;
   101 TurnTimeLeft:= 0;
    93 if TeamsCount = 0 then
   102 if AliveCount = 0 then
    94    begin // draw
   103    begin // draw
    95    AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState);
   104    AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState);
    96    SendStat(siGameResult, trmsg[sidDraw]);
   105    SendStat(siGameResult, trmsg[sidDraw]);
    97    AddGear(0, 0, gtATFinishGame, 0, _0, _0, 2000)
   106    AddGear(0, 0, gtATFinishGame, 0, _0, _0, 2000)
    98    end else // win
   107    end else // win