aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/ai-inventory.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-08 01:55:30 +0530
committerEugene Sandulenko2019-09-03 17:17:14 +0200
commit32465a119d4371093b686c72a7cd9efe00d1c91b (patch)
tree8f16c9f86070ddffe6999dda145e86cbe6ef76c9 /engines/hdb/ai-inventory.cpp
parent69303997aee1518b26eac27c60454bfb0633dc94 (diff)
downloadscummvm-rg350-32465a119d4371093b686c72a7cd9efe00d1c91b.tar.gz
scummvm-rg350-32465a119d4371093b686c72a7cd9efe00d1c91b.tar.bz2
scummvm-rg350-32465a119d4371093b686c72a7cd9efe00d1c91b.zip
HDB: Modify InvEnt to have AIEntity as member
Diffstat (limited to 'engines/hdb/ai-inventory.cpp')
-rw-r--r--engines/hdb/ai-inventory.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp
index 65e84339f5..8ed6e9e28a 100644
--- a/engines/hdb/ai-inventory.cpp
+++ b/engines/hdb/ai-inventory.cpp
@@ -60,7 +60,7 @@ bool AI::addToInventory(AIEntity *e) {
return false;
}
- _inventory[_numInventory].ent = e;
+ _inventory[_numInventory].ent = *e;
_numInventory++;
// If weapon, ready it
@@ -106,7 +106,7 @@ void AI::clearInventory() {
AIEntity *AI::getInvItem(int which) {
if (which >= _numInventory)
return NULL;
- return _inventory[which].ent;
+ return &_inventory[which].ent;
}
int AI::queryInventory(const char *string) {
@@ -124,7 +124,7 @@ int AI::queryInventory(const char *string) {
count = 0;
for (i = _numInventory - 1; i >= 0; i--)
- if (_inventory[i].ent->entityName && strstr(_inventory[i].ent->entityName, string))
+ if (_inventory[i].ent.entityName && strstr(_inventory[i].ent.entityName, string))
count++;
return count;
@@ -153,7 +153,7 @@ bool AI::removeInvItem(const char *string, int amount) {
found = 0;
for (i = _numInventory - 1; i >= 0; i--)
- if (_inventory[i].ent->entityName && strstr(_inventory[i].ent->entityName, string)) {
+ if (_inventory[i].ent.entityName && strstr(_inventory[i].ent.entityName, string)) {
j = i;
memset(&_inventory[j], 0, sizeof(InvEnt));
while (j < _numInventory - 1) {
@@ -191,7 +191,7 @@ int AI::queryInventoryType(AIType which) {
count = 0;
for (i = 0; i < _numInventory; i++)
- if (_inventory[i].ent->type == which)
+ if (_inventory[i].ent.type == which)
count++;
return count;
@@ -219,7 +219,7 @@ bool AI::removeInvItemType(AIType which, int amount) {
found = 0;
for (i = 0; i < _numInventory; i++)
- if (_inventory[i].ent->type == which) {
+ if (_inventory[i].ent.type == which) {
j = i;
memset(&_inventory[j], 0, sizeof(InvEnt));
while (j < _numInventory - 1) {
@@ -258,7 +258,7 @@ bool AI::addItemToInventory(AIType type, int amount, const char *funcInit, const
void AI::keepInvItem(AIType type) {
for (int i = 0; i < _numInventory; i++)
- if (_inventory[i].ent->type == type)
+ if (_inventory[i].ent.type == type)
_inventory[i].keep = 1;
}