mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
- check for overflows when giving inventory items.
SVN r3515 (trunk)
This commit is contained in:
parent
64f0e0e984
commit
9f58a15e28
1 changed files with 17 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue