Fix team getting inf. ammo when stockpiling >= 100 ammo
authorWuzzy <almikes@aol.com>
Sun, 08 Oct 2017 04:57:28 +0200
changeset 12676 87b3009f51c3
parent 12675 967990d958bc
child 12677 c98179b00740
Fix team getting inf. ammo when stockpiling >= 100 ammo
ChangeLog.txt
hedgewars/uAmmos.pas
hedgewars/uConsts.pas
--- a/ChangeLog.txt	Sun Oct 08 04:14:49 2017 +0200
+++ b/ChangeLog.txt	Sun Oct 08 04:57:28 2017 +0200
@@ -51,6 +51,7 @@
  * Fixed cake taking over 200 seconds to explode when its stuck and can't move
  * Fixed Birdy descending into water when hog took damage or died before it got picked up
  * Fixed teleportation being able to teleport in land if you clicked in the "dark" area of the wrap world edge
+ * Fixed team getting infinite ammo when stockpiling >= 100 ammo (max. finite ammo is now limited to 99)
  * Remove buggy /finish chat command
  * Various other fixes
 
--- a/hedgewars/uAmmos.pas	Sun Oct 08 04:14:49 2017 +0200
+++ b/hedgewars/uAmmos.pas	Sun Oct 08 04:57:28 2017 +0200
@@ -212,7 +212,7 @@
     cnt:= 0;
 if (cnt <> AMMO_INFINITE) then
     begin
-    inc(cnt, amt);
+    cnt:= min(AMMO_FINITE_MAX, cnt + amt);
     SetAmmo(Hedgehog, ammo, cnt)
     end
 end;
--- a/hedgewars/uConsts.pas	Sun Oct 08 04:14:49 2017 +0200
+++ b/hedgewars/uConsts.pas	Sun Oct 08 04:57:28 2017 +0200
@@ -311,6 +311,7 @@
     ammoprop_NoRoundEnd   = $10000000;
 
     AMMO_INFINITE = 100;
+    AMMO_FINITE_MAX = 99;
 
     // explosion flags
     //EXPLAllDamageInRadius = $00000001;  Completely unused for ages