- removed all direct references of AInventory::Owner and AInventory::Amount from the C++ code.

This commit is contained in:
Christoph Oelckers 2018-12-03 00:43:01 +01:00
commit 0e095b0c05
15 changed files with 124 additions and 157 deletions

View file

@ -625,7 +625,7 @@ DEFINE_ACTION_FUNCTION(AActor, InStateSequence)
bool AActor::IsMapActor()
{
// [SP] Don't remove owned inventory objects.
return (!IsKindOf(NAME_Inventory) || static_cast<AInventory *>(this)->Owner == nullptr);
return (!IsKindOf(NAME_Inventory) || GC::ReadBarrier(PointerVar<AActor>(NAME_Owner)) == nullptr);
}
//==========================================================================
@ -783,7 +783,7 @@ void AActor::DestroyAllInventory ()
toDelete.Push(inv);
AInventory *item = inv->Inventory;
inv->Inventory = nullptr;
inv->Owner = nullptr;
inv->PointerVar<AActor>(NAME_Owner) = nullptr;
inv = item;
}
for (auto p : toDelete)
@ -1006,9 +1006,9 @@ void AActor::ObtainInventory (AActor *other)
}
AInventory *item = Inventory;
while (item != NULL)
while (item != nullptr)
{
item->Owner = this;
item->PointerVar<AActor>(NAME_Owner) = this;
item = item->Inventory;
}
}
@ -3788,7 +3788,7 @@ void AActor::Tick ()
// by the order in the inventory, not the order in the thinker table
AInventory *item = Inventory;
while (item != NULL && item->Owner == this)
while (item != NULL)
{
IFVIRTUALPTR(item, AInventory, DoEffect)
{