hedgewars/uAmmos.pas
changeset 2409 dbf195c3e09c
parent 2370 2ff8fce5e06f
child 2431 23242609c44b
equal deleted inserted replaced
2408:41ebdb5f1e6e 2409:dbf195c3e09c
   214 begin
   214 begin
   215 TargetPoint.X:= NoPointX;
   215 TargetPoint.X:= NoPointX;
   216 
   216 
   217 with Hedgehog do
   217 with Hedgehog do
   218 	begin
   218 	begin
       
   219 
   219 	if (Ammo^[CurSlot, CurAmmo].Count = 0) then
   220 	if (Ammo^[CurSlot, CurAmmo].Count = 0) then
   220 		begin
   221 		begin
   221 		CurAmmo:= 0;
   222 		CurAmmo:= 0;
   222 		CurSlot:= 0;
   223 		CurSlot:= 0;
   223 		while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
   224 		while (CurSlot < cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do 
       
   225                         inc(CurSlot)
   224 		end;
   226 		end;
   225 
   227                 
       
   228         //bad things could happen here in case CurSlot is overflowing
   226 	ApplyAngleBounds(Hedgehog, Ammo^[CurSlot, CurAmmo].AmmoType);
   229 	ApplyAngleBounds(Hedgehog, Ammo^[CurSlot, CurAmmo].AmmoType);
   227 
   230 
   228 	with Ammo^[CurSlot, CurAmmo] do
   231 	with Ammo^[CurSlot, CurAmmo] do
   229 		begin
   232 		begin
   230         if AmmoType <> amNothing then
   233         if AmmoType <> amNothing then
   255      if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or
   258      if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or
   256         (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0) then
   259         (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0) then
   257         begin
   260         begin
   258         CurAmmo:= 0;
   261         CurAmmo:= 0;
   259         CurSlot:= 0;
   262         CurSlot:= 0;
   260         while (CurSlot <= cMaxSlotIndex) and
   263         while (CurSlot < cMaxSlotIndex) and
   261               ((Ammo^[CurSlot, CurAmmo].Count = 0) or
   264               ((Ammo^[CurSlot, CurAmmo].Count = 0) or
   262               (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0))
   265               (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0))
   263               do inc(CurSlot)
   266               do inc(CurSlot)
   264         end
   267         end
   265 end;
   268 end;