hedgewars/uTeams.pas
changeset 6450 14224c9b4594
parent 6211 ee9465c0ea82
child 6543 697e9b730189
equal deleted inserted replaced
6448:88e49851d814 6450:14224c9b4594
   140         end;
   140         end;
   141 
   141 
   142 c:= CurrentTeam^.Clan^.ClanIndex;
   142 c:= CurrentTeam^.Clan^.ClanIndex;
   143 repeat
   143 repeat
   144     with ClansArray[c]^ do
   144     with ClansArray[c]^ do
   145         if (CurrTeam = TagTeamIndex) and ((GameFlags And gfTagTeam) <> 0) then
   145         if (CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0) then
   146             begin
   146             begin
   147             TagTeamIndex:= Pred(TagTeamIndex) mod TeamsNumber;
   147             TagTeamIndex:= Pred(TagTeamIndex) mod TeamsNumber;
   148             CurrTeam:= Pred(CurrTeam) mod TeamsNumber;
   148             CurrTeam:= Pred(CurrTeam) mod TeamsNumber;
   149             inc(c);
   149             inc(c);
   150             NextClan:= true;
   150             NextClan:= true;
   151             end;
   151             end;
   152 
   152 
   153     if (GameFlags And gfTagTeam) = 0 then inc(c);
   153     if (GameFlags and gfTagTeam) = 0 then inc(c);
   154 
   154 
   155     if c = ClansCount then
   155     if c = ClansCount then
   156         begin
   156         begin
   157         if not PlacingHogs then inc(TotalRounds);
   157         if not PlacingHogs then inc(TotalRounds);
   158         c:= 0
   158         c:= 0
   169                 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
   169                 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
   170                 repeat
   170                 repeat
   171                     CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   171                     CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   172                 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   172                 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   173                 end
   173                 end
   174         until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags And gfTagTeam) <> 0));
   174         until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0));
   175         end
   175         end
   176 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
   176 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
   177 
   177 
   178 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
   178 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
   179 end;
   179 end;
   241 if PlacingHogs then
   241 if PlacingHogs then
   242     begin
   242     begin
   243     if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 15000
   243     if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 15000
   244     else TurnTimeLeft:= 0
   244     else TurnTimeLeft:= 0
   245     end
   245     end
   246 else if ((GameFlags And gfTagTeam) <> 0) and not NextClan then
   246 else if ((GameFlags and gfTagTeam) <> 0) and (not NextClan) then
   247     begin
   247     begin
   248     if TagTurnTimeLeft <> 0 then TurnTimeLeft:= TagTurnTimeLeft;
   248     if TagTurnTimeLeft <> 0 then TurnTimeLeft:= TagTurnTimeLeft;
   249     TagTurnTimeLeft:= 0;
   249     TagTurnTimeLeft:= 0;
   250     end
   250     end
   251 else
   251 else