aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/ai-inventory.cpp12
-rw-r--r--engines/hdb/ai.h1
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);