From de4fc97ac665114bdc4ed46e46c528be0b7191e1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 31 Dec 2017 13:30:30 +0200 Subject: [PATCH] Fixed ammo limit for give cheat https://forum.zdoom.org/viewtopic.php?t=58930 --- src/p_mobj.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index dc0e76ad1..1cc9d96f6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -829,10 +829,16 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat) } else { - if (!givecheat) - item->Amount = amount; + if (givecheat) + { + item->Amount = MIN(amount, type->IsDescendantOf(NAME_Ammo) + ? item->IntVar("BackpackMaxAmount") + : item->MaxAmount); + } else - item->Amount = MIN (amount, item->MaxAmount); + { + item->Amount = amount; + } } } if (!item->CallTryPickup (this))