- scriptified RemoveInventory and Inventory.OnDestroy.
This commit is contained in:
parent
eb47fb9adc
commit
023efc7685
10 changed files with 122 additions and 120 deletions
|
|
@ -753,48 +753,6 @@ DEFINE_ACTION_FUNCTION(AActor, SetState)
|
|||
ACTION_RETURN_BOOL(self->SetState(state, nofunction));
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// AActor :: RemoveInventory
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void AActor::RemoveInventory(AInventory *item)
|
||||
{
|
||||
AInventory *inv, **invp;
|
||||
|
||||
if (item != NULL && item->Owner != NULL) // can happen if the owner was destroyed by some action from an item's use state.
|
||||
{
|
||||
invp = &item->Owner->Inventory;
|
||||
for (inv = *invp; inv != NULL; invp = &inv->Inventory, inv = *invp)
|
||||
{
|
||||
if (inv == item)
|
||||
{
|
||||
*invp = item->Inventory;
|
||||
|
||||
IFVIRTUALPTR(item, AInventory, DetachFromOwner)
|
||||
{
|
||||
VMValue params[1] = { item };
|
||||
VMCall(func, params, 1, nullptr, 0);
|
||||
}
|
||||
|
||||
item->Owner = NULL;
|
||||
item->Inventory = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, RemoveInventory)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_OBJECT_NOT_NULL(item, AInventory);
|
||||
self->RemoveInventory(item);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// AActor :: TakeInventory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue