From fe74a144315be2a97412490d86c22e3e946b9459 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 12 Nov 2016 14:48:10 +0100 Subject: [PATCH] - fixed: A_GiveInventory should not try to give stuff to an owned inventory item, because it doesn't own its Inventory pointer - it is used for the linked list of the owner's inventory. --- src/CMakeLists.txt | 1 - src/p_actionfunctions.cpp | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b2f23afb14..66371220b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -857,7 +857,6 @@ set( NOT_COMPILED_SOURCE_FILES g_heretic/a_hereticartifacts.cpp g_heretic/a_hereticweaps.cpp g_heretic/a_ironlich.cpp - g_hexen/a_bats.cpp g_hexen/a_bishop.cpp g_hexen/a_blastradius.cpp g_hexen/a_boostarmor.cpp diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 1cfc44ae2f..a99ba9ab61 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -2491,6 +2491,11 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) { // If there's nothing to receive it, it's obviously a fail, right? return false; } + // Owned inventory items cannot own anything because their Inventory pointer is repurposed for the owner's linked list. + if (receiver->IsKindOf(RUNTIME_CLASS(AInventory)) && static_cast(receiver)->Owner != nullptr) + { + return false; + } if (amount <= 0) {