hedgewars/uTeams.pas
changeset 1687 a73c8cda1ed1
parent 1678 c8deca7b1e3c
child 1906 644f93d8f148
equal deleted inserted replaced
1686:f42dbc52225c 1687:a73c8cda1ed1
   183 		repeat
   183 		repeat
   184 			CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
   184 			CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
   185 			CurrentTeam:= Teams[CurrTeam];
   185 			CurrentTeam:= Teams[CurrTeam];
   186 			with CurrentTeam^ do
   186 			with CurrentTeam^ do
   187 				begin
   187 				begin
   188 				PrevHH:= CurrHedgehog;
   188 				PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn
   189 				repeat
   189 				repeat
   190 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   190 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   191 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   191 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   192 				end
   192 				end
   193 		until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone)) or (PrevTeam = CurrTeam);
   193 		until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone)) or (PrevTeam = CurrTeam);