diff options
author | Nipun Garg | 2019-06-21 03:20:59 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:52 +0200 |
commit | 5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e (patch) | |
tree | dba28a7b707be44ac48c065945689c6d7902b65f | |
parent | 15c2a946d197e99fb9eb036e23ecb7253c69cab9 (diff) | |
download | scummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.tar.gz scummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.tar.bz2 scummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.zip |
HDB: Add clearInventory()
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 17 | ||||
-rw-r--r-- | engines/hdb/ai.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index ea23dd2295..dd4e6ae3cc 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -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 diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 89491b6e7b..8e6a7ab8d7 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -636,6 +636,7 @@ public: // Inventory Functions bool addToInventory(AIEntity *e); + void clearInventory(); // Cinematic Variables Common::Array<CineCommand *> _cine; |