Fixed ammo limit for give cheat

https://forum.zdoom.org/viewtopic.php?t=58930
This commit is contained in:
alexey.lysiuk 2017-12-31 13:30:30 +02:00
parent 40fd816d54
commit de4fc97ac6
1 changed files with 9 additions and 3 deletions

View File

@ -829,10 +829,16 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat)
} }
else else
{ {
if (!givecheat) if (givecheat)
item->Amount = amount; {
item->Amount = MIN(amount, type->IsDescendantOf(NAME_Ammo)
? item->IntVar("BackpackMaxAmount")
: item->MaxAmount);
}
else else
item->Amount = MIN (amount, item->MaxAmount); {
item->Amount = amount;
}
} }
} }
if (!item->CallTryPickup (this)) if (!item->CallTryPickup (this))