diff options
author | Nipun Garg | 2019-07-14 00:48:44 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:19 +0200 |
commit | de7b30a23cdb90e0ed6e7c1373800f98df675cf1 (patch) | |
tree | b8d2701a2dd2cc58ba54ee2adf3c82d35bf5e58a | |
parent | fe09a9c09c4cd5fc4039ea0c40caa8e814ac179f (diff) | |
download | scummvm-rg350-de7b30a23cdb90e0ed6e7c1373800f98df675cf1.tar.gz scummvm-rg350-de7b30a23cdb90e0ed6e7c1373800f98df675cf1.tar.bz2 scummvm-rg350-de7b30a23cdb90e0ed6e7c1373800f98df675cf1.zip |
HDB: Add queryInventoryTypeSlot()
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 12 | ||||
-rw-r--r-- | engines/hdb/ai.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 8ed6e9e28a..a26610ee26 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -197,6 +197,18 @@ int AI::queryInventoryType(AIType which) { return count; } +int AI::queryInventoryTypeSlot(AIType which) { + int i; + + if (!_numInventory) + return 0; + + for (i = 0; i < _numInventory; i++) + if (_inventory[i].ent.type == which) + return i; + return -1; +} + bool AI::removeInvItemType(AIType which, int amount) { int i, j, found; diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index fcafdd8fc2..f3802d554f 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -1065,6 +1065,7 @@ public: int queryInventory(const char *string); bool removeInvItem(const char *string, int amount); int queryInventoryType(AIType which); + int queryInventoryTypeSlot(AIType which); bool removeInvItemType(AIType which, int amount); bool addItemToInventory(AIType type, int amount, const char *funcInit, const char *funcAction, const char *funcUse); void keepInvItem(AIType type); |