# HG changeset patch # User Wuzzy # Date 1533834898 -7200 # Node ID d5fe7db1baa995e7cf86df0a2cbeb04c87f1154c # Parent f606ca8b80fd6251a04c101f7fa38678985dddba Fix TotalRounds increasing incorrectly if gfRandomOrder is off diff -r f606ca8b80fd -r d5fe7db1baa9 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu Aug 09 17:49:17 2018 +0200 +++ b/hedgewars/uTeams.pas Thu Aug 09 19:14:58 2018 +0200 @@ -51,6 +51,7 @@ var TeamsGameOver: boolean; NextClan: boolean; + SwapClan: LongInt; function CheckForWin: boolean; var AliveClan: PClan; @@ -204,12 +205,10 @@ if (GameFlags and gfTagTeam) = 0 then inc(c); + if (c = SwapClan) and (not PlacingHogs) then + inc(TotalRounds); if c = ClansCount then - begin - if not PlacingHogs then - inc(TotalRounds); - c:= 0 - end; + c:= 0; with ClansArray[c]^ do begin @@ -285,9 +284,17 @@ if ClansArray[i] <> nil then ClansArray[i]^.TurnNumber:= 0; ResetWeapons - end + end; + end; +// Clan ID (+1) to check to determine whether to increase TotalRounds +if (SwapClan = -1) and (not PlacingHogs) then + if (GameFlags and gfRandomOrder) <> 0 then + SwapClan:= ClansCount + else + SwapClan:= 1; + inc(CurrentTeam^.Clan^.TurnNumber); with CurrentTeam^.Clan^ do for t:= 0 to Pred(TeamsNumber) do @@ -874,6 +881,7 @@ LocalAmmo:= -1; TeamsGameOver:= false; NextClan:= true; +SwapClan:= -1; MaxTeamHealth:= 0; end; @@ -919,6 +927,7 @@ end; TeamsCount:= 0; ClansCount:= 0; +SwapClan:= -1; end; end.