diff options
author | Nipun Garg | 2019-06-22 07:41:58 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:55 +0200 |
commit | a39b9f373ca42c1ff25d2d479fee7efc071da498 (patch) | |
tree | d6aeef26dc149e9da44efe29b95f1e0c71bd3551 /engines/hdb/ai-inventory.cpp | |
parent | 653960f58aa623d6155cda6a03632a718f47a2c5 (diff) | |
download | scummvm-rg350-a39b9f373ca42c1ff25d2d479fee7efc071da498.tar.gz scummvm-rg350-a39b9f373ca42c1ff25d2d479fee7efc071da498.tar.bz2 scummvm-rg350-a39b9f373ca42c1ff25d2d479fee7efc071da498.zip |
HDB: Modify AI pointer arrays to be struct arrays
Diffstat (limited to 'engines/hdb/ai-inventory.cpp')
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 7505aef3df..25376bf513 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -61,7 +61,7 @@ bool AI::addToInventory(AIEntity *e) { return false; } - _inventory[_numInventory]->ent = e; + _inventory[_numInventory].ent = e; _numInventory++; // If weapon, ready it @@ -84,12 +84,14 @@ bool AI::addToInventory(AIEntity *e) { void AI::clearInventory() { int keepslot = 0; for (int i = 0; i < _numInventory; i++) { - if (!_inventory[i]->keep) { - _inventory[i] = NULL; + if (!_inventory[i].keep) { + memset(&_inventory[i], 0, sizeof(InvEnt)); } else { if (i != keepslot) { _inventory[keepslot] = _inventory[i]; - _inventory[i] = NULL; + _inventory[keepslot].ent = _inventory[i].ent; + _inventory[keepslot].keep = _inventory[i].keep; + memset(&_inventory[i], 0, sizeof(InvEnt)); } keepslot++; } |