# HG changeset patch
# User Wuzzy <almikes@aol.com>
# Date 1507431448 -7200
# Node ID 87b3009f51c389c945e48c641e37612b82593549
# Parent  967990d958bc2bb2d15ab04431b1d4ea73b4cddc
Fix team getting inf. ammo when stockpiling >= 100 ammo

diff -r 967990d958bc -r 87b3009f51c3 ChangeLog.txt
--- 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
 
diff -r 967990d958bc -r 87b3009f51c3 hedgewars/uAmmos.pas
--- 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;
diff -r 967990d958bc -r 87b3009f51c3 hedgewars/uConsts.pas
--- 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