hedgewars/uTeams.pas
changeset 12172 fe2946e2a859
parent 11913 232b57a70aca
child 12253 8e9603088f99
equal deleted inserted replaced
12171:115867d77982 12172:fe2946e2a859
    52 var GameOver: boolean;
    52 var GameOver: boolean;
    53     NextClan: boolean;
    53     NextClan: boolean;
    54 
    54 
    55 function CheckForWin: boolean;
    55 function CheckForWin: boolean;
    56 var AliveClan: PClan;
    56 var AliveClan: PClan;
    57     s, ts: ansistring;
    57     s, ts, cap: ansistring;
    58     t, AliveCount, i, j: LongInt;
    58     t, AliveCount, i, j: LongInt;
    59 begin
    59 begin
    60 CheckForWin:= false;
    60 CheckForWin:= false;
    61 AliveCount:= 0;
    61 AliveCount:= 0;
    62 for t:= 0 to Pred(ClansCount) do
    62 for t:= 0 to Pred(ClansCount) do
    79 
    79 
    80 if not GameOver then
    80 if not GameOver then
    81     begin
    81     begin
    82     if AliveCount = 0 then
    82     if AliveCount = 0 then
    83         begin // draw
    83         begin // draw
    84         AddCaption(trmsg[sidDraw], cWhiteColor, capgrpGameState);
    84         AddCaption(GetEventString(eidRoundDraw), cWhiteColor, capgrpGameState);
    85         SendStat(siGameResult, shortstring(trmsg[sidDraw]));
    85         SendStat(siGameResult, shortstring(trmsg[sidDraw]));
    86         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
    86         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000);
    87         end
    87         end
    88     else // win
    88     else // win
    89         with AliveClan^ do
    89         with AliveClan^ do
    90             begin
    90             begin
    91             ts:= ansistring(Teams[0]^.TeamName);
    91             ts:= ansistring(Teams[0]^.TeamName);
    92             if TeamsNumber = 1 then
    92             if TeamsNumber = 1 then // team wins
    93                 s:= FormatA(trmsg[sidWinner], ts)  // team wins
    93                 begin
    94             else
    94                 s:= FormatA(trmsg[sidWinner], ts);
    95                 s:= FormatA(trmsg[sidWinner], ts); // clan wins
    95                 cap:= FormatA(GetEventString(eidRoundWin), ts);
       
    96                 end
       
    97             else // clan wins
       
    98                 // FIXME: Clan needs a different message
       
    99                 begin
       
   100                 s:= FormatA(trmsg[sidWinner], ts);
       
   101                 cap:= FormatA(GetEventString(eidRoundWin), ts);
       
   102                 end;
    96 
   103 
    97             for j:= 0 to Pred(TeamsNumber) do
   104             for j:= 0 to Pred(TeamsNumber) do
    98                 with Teams[j]^ do
   105                 with Teams[j]^ do
    99                     for i:= 0 to cMaxHHIndex do
   106                     for i:= 0 to cMaxHHIndex do
   100                         with Hedgehogs[i] do
   107                         with Hedgehogs[i] do
   103             if Flawless then
   110             if Flawless then
   104                 AddVoice(sndFlawless, Teams[0]^.voicepack)
   111                 AddVoice(sndFlawless, Teams[0]^.voicepack)
   105             else
   112             else
   106                 AddVoice(sndVictory, Teams[0]^.voicepack);
   113                 AddVoice(sndVictory, Teams[0]^.voicepack);
   107 
   114 
   108             AddCaption(s, cWhiteColor, capgrpGameState);
   115             AddCaption(cap, cWhiteColor, capgrpGameState);
   109             SendStat(siGameResult, shortstring(s));
   116             SendStat(siGameResult, shortstring(s));
   110             AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   117             AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   111             end;
   118             end;
   112     SendStats;
   119     SendStats;
   113     end;
   120     end;