Merge pull request #319 from edward-san/inventory
Little TakeInventory refactoring.
This commit is contained in:
commit
ce4adc48a7
10 changed files with 92 additions and 107 deletions
|
|
@ -1049,24 +1049,7 @@ void cht_Take (player_t *player, const char *name, int amount)
|
|||
}
|
||||
else
|
||||
{
|
||||
AInventory *inventory = player->mo->FindInventory (type);
|
||||
|
||||
if (inventory != NULL)
|
||||
{
|
||||
inventory->Amount -= amount ? amount : 1;
|
||||
|
||||
if (inventory->Amount <= 0)
|
||||
{
|
||||
if (inventory->ItemFlags & IF_KEEPDEPLETED)
|
||||
{
|
||||
inventory->Amount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory->Destroy ();
|
||||
}
|
||||
}
|
||||
}
|
||||
player->mo->TakeInventory(type, amount ? amount : 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue