HDB: Add clearInventory()

This commit is contained in:
Nipun Garg 2019-06-21 03:20:59 +05:30 committed by Eugene Sandulenko
parent 15c2a946d1
commit 5c2cfac209
2 changed files with 18 additions and 0 deletions

View File

@ -79,4 +79,21 @@ bool AI::addToInventory(AIEntity *e) {
return true;
}
// Clear out the Player inventory except Gems,
// Monkeystones and Goo Cups unless its marked
void AI::clearInventory() {
int keepslot = 0;
for (int i = 0; i < _numInventory; i++) {
if (!_inventory[i]->keep) {
_inventory[i] = NULL;
} else {
if (i != keepslot) {
_inventory[keepslot] = _inventory[i];
_inventory[i] = NULL;
}
keepslot++;
}
}
_numInventory = keepslot;
}
} // End of Namespace

View File

@ -636,6 +636,7 @@ public:
// Inventory Functions
bool addToInventory(AIEntity *e);
void clearInventory();
// Cinematic Variables
Common::Array<CineCommand *> _cine;