- scriptified GiveAmmo and the one remaining piece of native code still using it.

This commit is contained in:
Christoph Oelckers 2018-12-01 17:20:23 +01:00
commit 7301bbc58e
6 changed files with 55 additions and 64 deletions

View file

@ -942,44 +942,6 @@ DEFINE_ACTION_FUNCTION(AActor, GiveInventoryType)
ACTION_RETURN_OBJECT(self->GiveInventoryType(type));
}
//============================================================================
//
// AActor :: GiveAmmo
//
// Returns true if the ammo was added, false if not.
//
//============================================================================
bool AActor::GiveAmmo (PClassActor *type, int amount)
{
if (type != NULL)
{
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory))) return false;
AInventory *item = static_cast<AInventory *>(Spawn (type));
if (item)
{
item->Amount = amount;
item->flags |= MF_DROPPED;
if (!item->CallTryPickup (this))
{
item->Destroy ();
return false;
}
return true;
}
}
return false;
}
DEFINE_ACTION_FUNCTION(AActor, GiveAmmo)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(type, AInventory);
PARAM_INT(amount);
ACTION_RETURN_BOOL(self->GiveAmmo(type, amount));
}
//============================================================================
//
// AActor :: ClearInventory