diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 478c64524..ceb97fc3d 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -86,7 +86,14 @@ bool AAmmo::HandlePickup (AInventory *item) } int oldamount = Amount; - Amount += receiving; + if (Amount > 0 && Amount + receiving < 0) + { + Amount = 0x7fffffff; + } + else + { + Amount += receiving; + } if (Amount > MaxAmount && !sv_unlimited_pickup) { Amount = MaxAmount; @@ -538,7 +545,15 @@ bool AInventory::HandlePickup (AInventory *item) { if (Amount < MaxAmount || sv_unlimited_pickup) { - Amount += item->Amount; + if (Amount > 0 && Amount + item->Amount < 0) + { + Amount = 0x7fffffff; + } + else + { + Amount += item->Amount; + } + if (Amount > MaxAmount && !sv_unlimited_pickup) { Amount = MaxAmount;