diff options
author | Nipun Garg | 2019-07-08 01:55:30 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:14 +0200 |
commit | 32465a119d4371093b686c72a7cd9efe00d1c91b (patch) | |
tree | 8f16c9f86070ddffe6999dda145e86cbe6ef76c9 /engines | |
parent | 69303997aee1518b26eac27c60454bfb0633dc94 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/hdb/ai-funcs.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 14 | ||||
-rw-r--r-- | engines/hdb/ai.h | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index 56b021a567..1cd1b23255 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -739,7 +739,7 @@ void AI::initAllEnts() { int i; for (i = 0; i < _numInventory; i++) { - AIEntity *temp = _inventory[i].ent; + AIEntity *temp = &_inventory[i].ent; // Clear out all ptrs in entity before writing for (int j = 0; j < kMaxAnimFrames; j++) { 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; } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 02a928831a..e8bd20f047 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -581,9 +581,9 @@ struct AnimTarget { struct InvEnt { uint16 keep; - AIEntity *ent; + AIEntity ent; - InvEnt() : keep(0), ent(NULL) {} + InvEnt() : keep(0) {} }; struct DlvEnt { @@ -1013,10 +1013,10 @@ public: return _numInventory; } AIType getInvItemType(int which) { - return _inventory[which].ent->type; + return _inventory[which].ent.type; } Tile *getInvItemGfx(int which) { - return _inventory[which].ent->standdownGfx[0]; + return _inventory[which].ent.standdownGfx[0]; } AIEntity *getInvItem(int which); |