- took the last methods aside from Tick and Serialize out of AInventory.

This commit is contained in:
Christoph Oelckers 2018-12-02 14:56:10 +01:00
commit 2cb0b2db87
6 changed files with 33 additions and 55 deletions

View file

@ -174,57 +174,15 @@ DEFINE_ACTION_FUNCTION(AInventory, PrintPickupMessage)
//
//===========================================================================
void AInventory::DepleteOrDestroy ()
void DepleteOrDestroy (AInventory *item)
{
IFVIRTUAL(AInventory, DepleteOrDestroy)
IFVIRTUALPTR(item, AInventory, DepleteOrDestroy)
{
VMValue params[1] = { (DObject*)this };
VMValue params[1] = { item };
VMCall(func, params, 1, nullptr, 0);
}
}
//===========================================================================
//
// AInventory :: PrevInv
//
// Returns the previous item with IF_INVBAR set.
//
//===========================================================================
AInventory *AInventory::PrevInv ()
{
AInventory *lastgood = NULL;
AInventory *item = Owner->Inventory;
while (item != NULL && item != this)
{
if (item->ItemFlags & IF_INVBAR)
{
lastgood = item;
}
item = item->Inventory;
}
return lastgood;
}
//===========================================================================
//
// AInventory :: NextInv
//
// Returns the next item with IF_INVBAR set.
//
//===========================================================================
AInventory *AInventory::NextInv ()
{
AInventory *item = Inventory;
while (item != NULL && !(item->ItemFlags & IF_INVBAR))
{
item = item->Inventory;
}
return item;
}
//===========================================================================
//
// AInventory :: CallTryPickup