mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-05-31 09:21:36 +00:00
- 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:
parent
5adb2fe690
commit
fe74a14431
2 changed files with 5 additions and 1 deletions
|
@ -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<AInventory*>(receiver)->Owner != nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (amount <= 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue