aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-inventory.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-21 03:20:59 +0530
committerEugene Sandulenko2019-09-03 17:16:52 +0200
commit5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e (patch)
treedba28a7b707be44ac48c065945689c6d7902b65f /engines/hdb/ai-inventory.cpp
parent15c2a946d197e99fb9eb036e23ecb7253c69cab9 (diff)
downloadscummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.tar.gz
scummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.tar.bz2
scummvm-rg350-5c2cfac2094a6161bb94c06b57efc0ae72a9eb7e.zip
HDB: Add clearInventory()
Diffstat (limited to 'engines/hdb/ai-inventory.cpp')
-rw-r--r--engines/hdb/ai-inventory.cpp17
1 files changed, 17 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