hedgewars/uTeams.pas
changeset 13650 34aeaa627400
parent 13649 d5fe7db1baa9
child 13651 56a925256039
equal deleted inserted replaced
13649:d5fe7db1baa9 13650:34aeaa627400
   191         LocalAmmo:= Hedgehogs[c].AmmoStore
   191         LocalAmmo:= Hedgehogs[c].AmmoStore
   192         end;
   192         end;
   193 
   193 
   194 c:= CurrentTeam^.Clan^.ClanIndex;
   194 c:= CurrentTeam^.Clan^.ClanIndex;
   195 repeat
   195 repeat
   196     with ClansArray[c]^ do
   196     if (GameFlags and gfTagTeam) <> 0 then
   197         if (CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0) then
   197         begin
       
   198         with ClansArray[c]^ do
   198             begin
   199             begin
   199             TagTeamIndex:= Pred(TagTeamIndex) mod TeamsNumber;
   200             if (CurrTeam = TagTeamIndex) then
   200             CurrTeam:= Pred(CurrTeam) mod TeamsNumber;
   201                 begin
   201             inc(c);
   202                 TagTeamIndex:= Pred(TagTeamIndex) mod TeamsNumber;
   202             NextClan:= true;
   203                 CurrTeam:= Pred(CurrTeam) mod TeamsNumber;
       
   204                 inc(c);
       
   205                 if c = ClansCount then
       
   206                     c:= 0;
       
   207                 NextClan:= true;
       
   208                 end;
   203             end;
   209             end;
   204 
   210 
   205     if (GameFlags and gfTagTeam) = 0 then
   211         with ClansArray[c]^ do
       
   212             begin
       
   213             if (c = SwapClan) and (not PlacingHogs) and ((Succ(CurrTeam) mod TeamsNumber) = TagTeamIndex) then
       
   214                 begin
       
   215                 inc(TotalRounds);
       
   216                 end;
       
   217             end;
       
   218         end
       
   219     else
       
   220         begin
   206         inc(c);
   221         inc(c);
   207 
   222         if c = ClansCount then
   208     if (c = SwapClan) and (not PlacingHogs) then
   223             c:= 0;
   209         inc(TotalRounds);
   224         if (c = SwapClan) and (not PlacingHogs) then
   210     if c = ClansCount then
   225             begin
   211         c:= 0;
   226             inc(TotalRounds);
       
   227             end;
       
   228         end;
   212 
   229 
   213     with ClansArray[c]^ do
   230     with ClansArray[c]^ do
   214         begin
   231         begin
   215         PrevTeam:= CurrTeam;
   232         PrevTeam:= CurrTeam;
   216         repeat
   233         repeat
   286         ResetWeapons
   303         ResetWeapons
   287         end;
   304         end;
   288 
   305 
   289     end;
   306     end;
   290 
   307 
   291 // Clan ID (+1) to check to determine whether to increase TotalRounds
   308 // Determine clan ID to check to determine whether to increase TotalRounds
   292 if (SwapClan = -1) and (not PlacingHogs) then
   309 if (SwapClan = -1) and (not PlacingHogs) then
       
   310     begin
   293     if (GameFlags and gfRandomOrder) <> 0 then
   311     if (GameFlags and gfRandomOrder) <> 0 then
   294         SwapClan:= ClansCount
   312         SwapClan:= 0
   295     else
   313     else
   296         SwapClan:= 1;
   314         SwapClan:= ClansCount - 1;
       
   315     end;
   297 
   316 
   298 inc(CurrentTeam^.Clan^.TurnNumber);
   317 inc(CurrentTeam^.Clan^.TurnNumber);
   299 with CurrentTeam^.Clan^ do
   318 with CurrentTeam^.Clan^ do
   300     for t:= 0 to Pred(TeamsNumber) do
   319     for t:= 0 to Pred(TeamsNumber) do
   301         with Teams[t]^ do
   320         with Teams[t]^ do