# HG changeset patch # User Wuzzy # Date 1536070373 -7200 # Node ID b1177e9c9ee989df61849beef85ecb92ec43a301 # Parent f0cb47f0bfafa88b75f0fb717bb52a178aac094d Fix player rankings getting confused if a clan was revived diff -r f0cb47f0bfaf -r b1177e9c9ee9 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Tue Sep 04 15:03:35 2018 +0200 +++ b/hedgewars/uGearsHandlersMess.pas Tue Sep 04 16:12:53 2018 +0200 @@ -5908,6 +5908,8 @@ RenderHealth(resgear^.Hedgehog^); RecountTeamHealth(resgear^.Hedgehog^.Team); resgear^.Hedgehog^.Effects[heResurrected]:= 1; + { Reviving a hog implies its clan is now alive, too. } + resgear^.Hedgehog^.Team^.Clan^.DeathLogged:= false; s:= ansistring(resgear^.Hedgehog^.Name); AddCaption(FormatA(GetEventString(eidResurrected), s), capcolDefault, capgrpMessage); // only make hat-less hedgehogs look like zombies, preserve existing hats diff -r f0cb47f0bfaf -r b1177e9c9ee9 hedgewars/uStats.pas --- a/hedgewars/uStats.pas Tue Sep 04 15:03:35 2018 +0200 +++ b/hedgewars/uStats.pas Tue Sep 04 16:12:53 2018 +0200 @@ -164,15 +164,15 @@ StepDied:= false; end; -// Remember which clans died in this turn +// Write into the death log which clans died in this turn, +// important for final rankings. c:= 0; newEntry:= nil; for t:= 0 to Pred(ClansCount) do with ClansArray[t]^ do begin - if (ClanHealth = 0) and (ClansArray[t]^.DiedThisTurn = false) then + if (ClanHealth = 0) and (ClansArray[t]^.DeathLogged = false) then begin - ClansArray[t]^.DiedThisTurn:= true; if c = 0 then begin new(newEntry); @@ -183,6 +183,7 @@ newEntry^.KilledClans[c]:= ClansArray[t]; inc(c); newEntry^.KilledClansCount := c; + ClansArray[t]^.DeathLogged:= true; end; if SendHealthStatsOn then @@ -386,7 +387,12 @@ The losing clans are ranked in the reverse order they died. The clan that died last is ranked 2nd, the clan that died second to last is ranked 3rd, - and so on. } + and so on. + Clans that died in the same turn share their rank. + If a clan died multiple times in the match + (e.g. due to resurrection), only the *latest* death of + that clan counts (handled in gtResurrector). + } deathEntry := ClanDeathLog; i:= 0; if SendRankingStatsOn then diff -r f0cb47f0bfaf -r b1177e9c9ee9 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Tue Sep 04 15:03:35 2018 +0200 +++ b/hedgewars/uTeams.pas Tue Sep 04 16:12:53 2018 +0200 @@ -310,7 +310,6 @@ if ClansArray[i] <> nil then begin ClansArray[i]^.TurnNumber:= 0; - ClansArray[i]^.DiedThisTurn:= false; end; ResetWeapons end; @@ -475,7 +474,7 @@ Color:= TeamColor; TagTeamIndex:= 0; Flawless:= true; - DiedThisTurn:= false; + DeathLogged:= false; StatsHandled:= false; end end diff -r f0cb47f0bfaf -r b1177e9c9ee9 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Tue Sep 04 15:03:35 2018 +0200 +++ b/hedgewars/uTypes.pas Tue Sep 04 16:12:53 2018 +0200 @@ -453,8 +453,8 @@ ClanHealth: LongInt; ClanIndex: LongInt; TurnNumber: LongWord; - DiedThisTurn: boolean; // true if clan died in current turn - StatsHandled : boolean; // true if clan has been handled for stats screen + DeathLogged: boolean; // true if clan is dead and its latest death has been logged in the clan death log + StatsHandled : boolean; // true if clan's rank has been handled for stats screen Flawless: boolean; end;