hedgewars/uAmmos.pas
changeset 927 2c1675344a6f
parent 883 07a568ba44e0
child 941 b5222ddafe1f
equal deleted inserted replaced
926:d231e007452a 927:2c1675344a6f
   129          end;
   129          end;
   130     until not b;
   130     until not b;
   131 end;
   131 end;
   132 
   132 
   133 procedure OnUsedAmmo(var Hedgehog: THedgehog);
   133 procedure OnUsedAmmo(var Hedgehog: THedgehog);
   134 var s, a: Longword;
       
   135 begin
   134 begin
   136 with Hedgehog do
   135 with Hedgehog do
   137      begin
   136      begin
   138      if CurAmmoGear = nil then begin s:= CurSlot; a:= CurAmmo end
   137      with Ammo^[CurSlot, CurAmmo] do
   139                           else begin s:= AltSlot; a:= AltAmmo end;
       
   140      with Ammo^[s, a] do
       
   141           if Count <> AMMO_INFINITE then
   138           if Count <> AMMO_INFINITE then
   142              begin
   139              begin
   143              dec(Count);
   140              dec(Count);
   144              if Count = 0 then PackAmmo(Ammo, CurSlot)
   141              if Count = 0 then PackAmmo(Ammo, CurSlot)
   145              end
   142              end