- Fixed a mistake in GiveInventory refactoring.
'give item' stopped working because commit7b35f32f3dand6aca7604ebdidn't take account that give cheat with zero amount should not touch the item amount.
This commit is contained in:
parent
a17ec55d0d
commit
3aee8a3eee
1 changed files with 15 additions and 12 deletions
|
|
@ -638,20 +638,23 @@ bool AActor::GiveInventory(PClassInventory *type, int amount, bool givecheat)
|
|||
|
||||
// This shouldn't count for the item statistics!
|
||||
item->ClearCounters();
|
||||
if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorPickup)))
|
||||
if (!givecheat || amount > 0)
|
||||
{
|
||||
static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount;
|
||||
}
|
||||
else if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)))
|
||||
{
|
||||
static_cast<ABasicArmorBonus*>(item)->SaveAmount *= amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!givecheat)
|
||||
item->Amount = amount;
|
||||
if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorPickup)))
|
||||
{
|
||||
static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount;
|
||||
}
|
||||
else if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)))
|
||||
{
|
||||
static_cast<ABasicArmorBonus*>(item)->SaveAmount *= amount;
|
||||
}
|
||||
else
|
||||
item->Amount = MIN (amount, item->MaxAmount);
|
||||
{
|
||||
if (!givecheat)
|
||||
item->Amount = amount;
|
||||
else
|
||||
item->Amount = MIN (amount, item->MaxAmount);
|
||||
}
|
||||
}
|
||||
if (!item->CallTryPickup (this))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue