Fix AddAmmo setting ammo to 99 when trying to add infinite ammo
authorWuzzy <Wuzzy2@mail.ru>
Sat, 21 Oct 2017 23:03:52 +0200
changeset 12738 353cb2ce6f9c
parent 12737 e7ed1b91c68b
child 12739 bb75ad94878b
Fix AddAmmo setting ammo to 99 when trying to add infinite ammo This affected the portal mission, the crate only gave you 99 portal guns instead of infinite.
hedgewars/uAmmos.pas
--- a/hedgewars/uAmmos.pas	Sat Oct 21 16:47:20 2017 -0400
+++ b/hedgewars/uAmmos.pas	Sat Oct 21 23:03:52 2017 +0200
@@ -210,11 +210,11 @@
     cnt:= a^.Count
 else
     cnt:= 0;
-if (cnt <> AMMO_INFINITE) then
-    begin
+if (cnt >= AMMO_INFINITE) or (amt >= AMMO_INFINITE) then
+    cnt:= AMMO_INFINITE
+else
     cnt:= min(AMMO_FINITE_MAX, cnt + amt);
-    SetAmmo(Hedgehog, ammo, cnt)
-    end
+SetAmmo(Hedgehog, ammo, cnt);
 end;
 
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);