Added A_SetInventory.

- Sets the absolute amount of an inventory actor.
- Limits itself to the range [0, MaxAmount]. Setting beyondMax to true disregards the MaxAmount. Default is false.
This commit is contained in:
Major Cooke 2016-10-11 14:44:31 -05:00
commit 5dc94a10c3
3 changed files with 89 additions and 0 deletions

View file

@ -634,6 +634,7 @@ void AActor::RemoveInventory(AInventory *item)
bool AActor::TakeInventory(PClassActor *itemclass, int amount, bool fromdecorate, bool notakeinfinite)
{
amount = abs(amount);
AInventory *item = FindInventory(itemclass);
if (item == NULL)
@ -666,6 +667,7 @@ bool AActor::TakeInventory(PClassActor *itemclass, int amount, bool fromdecorate
item->IsKindOf(RUNTIME_CLASS(AAmmo)))
{
// Nothing to do here, except maybe res = false;? Would it make sense?
result = false;
}
else if (!amount || amount>=item->Amount)
{