hedgewars/uStats.pas
changeset 13758 b1177e9c9ee9
parent 13757 f0cb47f0bfaf
child 13761 6fd56a26e8b8
equal deleted inserted replaced
13757:f0cb47f0bfaf 13758:b1177e9c9ee9
   162                 StepDamageGiven:= 0;
   162                 StepDamageGiven:= 0;
   163                 StepPoisoned:= false;
   163                 StepPoisoned:= false;
   164                 StepDied:= false;
   164                 StepDied:= false;
   165                 end;
   165                 end;
   166 
   166 
   167 // Remember which clans died in this turn
   167 // Write into the death log which clans died in this turn,
       
   168 // important for final rankings.
   168 c:= 0;
   169 c:= 0;
   169 newEntry:= nil;
   170 newEntry:= nil;
   170 for t:= 0 to Pred(ClansCount) do
   171 for t:= 0 to Pred(ClansCount) do
   171     with ClansArray[t]^ do
   172     with ClansArray[t]^ do
   172         begin
   173         begin
   173         if (ClanHealth = 0) and (ClansArray[t]^.DiedThisTurn = false) then
   174         if (ClanHealth = 0) and (ClansArray[t]^.DeathLogged = false) then
   174             begin
   175             begin
   175             ClansArray[t]^.DiedThisTurn:= true;
       
   176             if c = 0 then
   176             if c = 0 then
   177                 begin
   177                 begin
   178                 new(newEntry);
   178                 new(newEntry);
   179                 newEntry^.Turn := FinishedTurnsTotal;
   179                 newEntry^.Turn := FinishedTurnsTotal;
   180                 newEntry^.NextEntry := nil;
   180                 newEntry^.NextEntry := nil;
   181                 end;
   181                 end;
   182 
   182 
   183             newEntry^.KilledClans[c]:= ClansArray[t];
   183             newEntry^.KilledClans[c]:= ClansArray[t];
   184             inc(c);
   184             inc(c);
   185             newEntry^.KilledClansCount := c;
   185             newEntry^.KilledClansCount := c;
       
   186             ClansArray[t]^.DeathLogged:= true;
   186             end;
   187             end;
   187 
   188 
   188         if SendHealthStatsOn then
   189         if SendHealthStatsOn then
   189             SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth));
   190             SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth));
   190         end;
   191         end;
   384 
   385 
   385     { Now send player stats for loser teams/clans.
   386     { Now send player stats for loser teams/clans.
   386     The losing clans are ranked in the reverse order they died.
   387     The losing clans are ranked in the reverse order they died.
   387     The clan that died last is ranked 2nd,
   388     The clan that died last is ranked 2nd,
   388     the clan that died second to last is ranked 3rd,
   389     the clan that died second to last is ranked 3rd,
   389     and so on. }
   390     and so on.
       
   391     Clans that died in the same turn share their rank.
       
   392     If a clan died multiple times in the match
       
   393     (e.g. due to resurrection), only the *latest* death of
       
   394     that clan counts (handled in gtResurrector).
       
   395     }
   390     deathEntry := ClanDeathLog;
   396     deathEntry := ClanDeathLog;
   391     i:= 0;
   397     i:= 0;
   392     if SendRankingStatsOn then
   398     if SendRankingStatsOn then
   393         while (deathEntry <> nil) do
   399         while (deathEntry <> nil) do
   394             begin
   400             begin