From e47f016b23a3146c9bc810ff21c2a3434dc0a716 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 12 Jun 2020 23:11:45 +0200 Subject: [PATCH] - fixed: AActor::GetModifiedDamage must account for the inventory items to get destroyed in its scripted subfunctions. --- src/playsim/p_mobj.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index a2fc66faa..9f64cd986 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -7359,14 +7359,15 @@ void AActor::ClearCounters() int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive, AActor *inflictor, AActor *source, int flags) { auto inv = Inventory; - while (inv != nullptr) + while (inv != nullptr && !(inv->ObjectFlags & OF_EuthanizeMe)) { + auto nextinv = inv->Inventory; IFVIRTUALPTRNAME(inv, NAME_Inventory, ModifyDamage) { VMValue params[8] = { (DObject*)inv, damage, damagetype.GetIndex(), &damage, passive, inflictor, source, flags }; VMCall(func, params, 8, nullptr, 0); } - inv = inv->Inventory; + inv = nextinv; } return damage; }