hedgewars/uAmmos.pas
changeset 5273 102728b20c4d
parent 5272 a85d331ab5bb
child 5316 191cd6c06203
--- a/hedgewars/uAmmos.pas	Mon Jun 20 18:58:26 2011 -0400
+++ b/hedgewars/uAmmos.pas	Mon Jun 20 19:00:19 2011 -0400
@@ -177,9 +177,14 @@
 end;
 
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
+var cnt: LongWord;
 begin
-if GetAmmoEntry(Hedgehog, ammo)^.Count <> AMMO_INFINITE then
-    AddAmmo(Hedgehog, ammo, Ammoz[ammo].NumberInCase);
+cnt:= GetAmmoEntry(Hedgehog, ammo)^.Count;
+if cnt <> AMMO_INFINITE then
+    begin
+    inc(cnt, Ammoz[ammo].NumberInCase);
+    AddAmmo(Hedgehog, ammo, cnt)
+    end
 end;
 
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);