hedgewars/uTeams.pas
changeset 13797 c084bd440009
parent 13763 6fd56a26e8b8
child 13811 3fa9e30927f1
equal deleted inserted replaced
13778:2e8b3081cf80 13797:c084bd440009
    56 function CheckForWin: boolean;
    56 function CheckForWin: boolean;
    57 var AliveClan: PClan;
    57 var AliveClan: PClan;
    58     s, cap: ansistring;
    58     s, cap: ansistring;
    59     ts: array[0..(cMaxTeams - 1)] of ansistring;
    59     ts: array[0..(cMaxTeams - 1)] of ansistring;
    60     t, AliveCount, i, j: LongInt;
    60     t, AliveCount, i, j: LongInt;
       
    61     allWin: boolean;
    61 begin
    62 begin
    62 CheckForWin:= false;
    63 CheckForWin:= false;
    63 AliveCount:= 0;
    64 AliveCount:= 0;
    64 for t:= 0 to Pred(ClansCount) do
    65 for t:= 0 to Pred(ClansCount) do
    65     if ClansArray[t]^.ClanHealth > 0 then
    66     if ClansArray[t]^.ClanHealth > 0 then
    96             AddVoice(sndNutter, TeamsArray[0]^.voicepack);
    97             AddVoice(sndNutter, TeamsArray[0]^.voicepack);
    97         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000);
    98         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000);
    98         end
    99         end
    99     else // win
   100     else // win
   100         begin
   101         begin
       
   102         allWin:= false;
   101         with AliveClan^ do
   103         with AliveClan^ do
   102             begin
   104             begin
   103             if TeamsNumber = 1 then // single team wins
   105             if TeamsNumber = 1 then // single team wins
   104                 begin
   106                 begin
   105                 s:= ansistring(Teams[0]^.TeamName);
   107                 s:= ansistring(Teams[0]^.TeamName);
   116                     ts[j] := Teams[j]^.TeamName;
   118                     ts[j] := Teams[j]^.TeamName;
   117                     end;
   119                     end;
   118 
   120 
   119                 // Write victory message for caption and stats page
   121                 // Write victory message for caption and stats page
   120                 if (TeamsNumber = cMaxTeams) or (TeamsCount = TeamsNumber) then
   122                 if (TeamsNumber = cMaxTeams) or (TeamsCount = TeamsNumber) then
       
   123                     begin
   121                     // No enemies for some reason … Everyone wins!!1!
   124                     // No enemies for some reason … Everyone wins!!1!
   122                     s:= trmsg[sidWinnerAll]
   125                     s:= trmsg[sidWinnerAll];
       
   126                     allWin:= true;
       
   127                     end
   123                 else if (TeamsNumber >= 2) and (TeamsNumber < cMaxTeams) then
   128                 else if (TeamsNumber >= 2) and (TeamsNumber < cMaxTeams) then
   124                     // List all winning teams in a list
   129                     // List all winning teams in a list
   125                     s:= FormatA(trmsg[TMsgStrId(Ord(sidWinner2) + (TeamsNumber - 2))], ts);
   130                     s:= FormatA(trmsg[TMsgStrId(Ord(sidWinner2) + (TeamsNumber - 2))], ts);
   126 
   131 
   127                 // The winner caption is the same as the stats message and not randomized
   132                 // The winner caption is the same as the stats message and not randomized
   142                 AddVoice(sndVictory, Teams[0]^.voicepack);
   147                 AddVoice(sndVictory, Teams[0]^.voicepack);
   143             end;
   148             end;
   144 
   149 
   145         if SendGameResultOn then
   150         if SendGameResultOn then
   146             SendStat(siGameResult, shortstring(s));
   151             SendStat(siGameResult, shortstring(s));
       
   152         if allWin and SendAchievementsStatsOn then
       
   153             SendStat(siEverAfter, '');
   147         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   154         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   148         end;
   155         end;
   149     SendStats;
   156     SendStats;
   150     end;
   157     end;
   151 TeamsGameOver:= true;
   158 TeamsGameOver:= true;