hedgewars/uTeams.pas
branchwebgl
changeset 8833 c13ebed437cb
parent 8444 75db7bb8dce8
parent 8681 d0fc1dca739c
child 9127 e350500c4edb
equal deleted inserted replaced
8450:404ddce27b23 8833:c13ebed437cb
   108     end;
   108     end;
   109 GameOver:= true
   109 GameOver:= true
   110 end;
   110 end;
   111 
   111 
   112 procedure SwitchHedgehog;
   112 procedure SwitchHedgehog;
   113 var c: LongWord;
   113 var c, i, j: LongWord;
   114     PrevHH, PrevTeam : LongWord;
   114     PrevHH, PrevTeam : LongWord;
   115 begin
   115 begin
   116 TargetPoint.X:= NoPointX;
   116 TargetPoint.X:= NoPointX;
   117 TryDo(CurrentTeam <> nil, 'nil Team', true);
   117 TryDo(CurrentTeam <> nil, 'nil Team', true);
   118 with CurrentHedgehog^ do
   118 with CurrentHedgehog^ do
   171         inc(c);
   171         inc(c);
   172 
   172 
   173     if c = ClansCount then
   173     if c = ClansCount then
   174         begin
   174         begin
   175         if not PlacingHogs then
   175         if not PlacingHogs then
       
   176             begin
   176             inc(TotalRounds);
   177             inc(TotalRounds);
       
   178             for i:= 0 to Pred(TeamsCount) do
       
   179                 with TeamsArray[i]^ do
       
   180                     for j:= 0 to Pred(HedgehogsNumber) do
       
   181                         with Hedgehogs[j] do
       
   182                             if Effects[heFrozen] > 255 then
       
   183                                 Effects[heFrozen]:= max(255,Effects[heFrozen]-50000)
       
   184             end;
   177         c:= 0
   185         c:= 0
   178         end;
   186         end;
   179 
   187 
   180     with ClansArray[c]^ do
   188     with ClansArray[c]^ do
   181         begin
   189         begin
   186             with CurrentTeam^ do
   194             with CurrentTeam^ do
   187                 begin
   195                 begin
   188                 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
   196                 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
   189                 repeat
   197                 repeat
   190                     CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   198                     CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
   191                 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
   199                 until ((Hedgehogs[CurrHedgehog].Gear <> nil) and (Hedgehogs[CurrHedgehog].Effects[heFrozen] = 0)) or (CurrHedgehog = PrevHH)
   192                 end
   200                 end
   193         until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0));
   201         until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0));
   194         end
   202         end
   195 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
   203 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] = 0);
   196 
   204 
   197 SwitchCurrentHedgehog(@(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]));
   205 SwitchCurrentHedgehog(@(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]));
   198 {$IFDEF USE_TOUCH_INTERFACE}
   206 {$IFDEF USE_TOUCH_INTERFACE}
   199 if (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
   207 if (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
   200     begin
   208     begin