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:
parent
bdbc7c3fb7
commit
5dc94a10c3
3 changed files with 89 additions and 0 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue