--- a/hedgewars/uAmmos.pas Wed Aug 24 13:33:53 2011 -0400
+++ b/hedgewars/uAmmos.pas Wed Aug 24 15:09:41 2011 -0400
@@ -156,7 +156,8 @@
ammoidx:= 0;
while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> am) do inc(ammoidx);
GetAmmoEntry:= @Ammo^[slot, ammoidx];
- end
+ if (Ammo^[slot, ammoidx].AmmoType <> am) then GetAmmoEntry:= GetAmmoEntry(Hedgehog, amNothing)
+ end;
end;
procedure AssignStores;
@@ -180,9 +181,10 @@
procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
var cnt: LongWord;
+ a: PAmmo;
begin
-cnt:= GetAmmoEntry(Hedgehog, ammo)^.Count;
-if cnt <> AMMO_INFINITE then
+a:= GetAmmoEntry(Hedgehog, ammo);
+if (a^.AmmoType = amNothing) or (a^.Count <> AMMO_INFINITE) then
begin
inc(cnt, Ammoz[ammo].NumberInCase);
AddAmmo(Hedgehog, ammo, cnt)