From 70ceced6b0fdf438020216c064b829f5c07fa871 Mon Sep 17 00:00:00 2001 From: Player701 Date: Tue, 17 Nov 2020 14:20:12 +0300 Subject: [PATCH] - Fixed: If AbsorbDamage resulted in an item having been destroyed, the following items in the inventory chain were not processed. --- src/p_mobj.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 57beac150..06867ce03 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3256,8 +3256,11 @@ bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle) int AActor::AbsorbDamage(int damage, FName dmgtype, AActor *inflictor, AActor *source, int flags) { - for (AActor *item = Inventory; item != nullptr; item = item->Inventory) + AActor *next; + for (AActor *item = Inventory; item != nullptr; item = next) { + // [Player701] Remember the next item now in case the current item is destroyed later + next = item->Inventory; IFVIRTUALPTRNAME(item, NAME_Inventory, AbsorbDamage) { VMValue params[7] = { item, damage, dmgtype.GetIndex(), &damage, inflictor, source, flags };