- 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.

This commit is contained in:
Christoph Oelckers 2016-11-12 14:48:10 +01:00
parent 5adb2fe690
commit fe74a14431
2 changed files with 5 additions and 1 deletions

View file

@ -857,7 +857,6 @@ set( NOT_COMPILED_SOURCE_FILES
g_heretic/a_hereticartifacts.cpp g_heretic/a_hereticartifacts.cpp
g_heretic/a_hereticweaps.cpp g_heretic/a_hereticweaps.cpp
g_heretic/a_ironlich.cpp g_heretic/a_ironlich.cpp
g_hexen/a_bats.cpp
g_hexen/a_bishop.cpp g_hexen/a_bishop.cpp
g_hexen/a_blastradius.cpp g_hexen/a_blastradius.cpp
g_hexen/a_boostarmor.cpp g_hexen/a_boostarmor.cpp

View file

@ -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? { // If there's nothing to receive it, it's obviously a fail, right?
return false; 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<AInventory*>(receiver)->Owner != nullptr)
{
return false;
}
if (amount <= 0) if (amount <= 0)
{ {