diff options
author | Eugene Sandulenko | 2013-06-20 14:52:31 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:48:13 +0300 |
commit | dac4f23f8464a3a5df3feebb2b74297df6a01c11 (patch) | |
tree | 4e9a904d02860a96efd24820b08da211981bdc9a /engines/fullpipe | |
parent | 8de8a901cb7946f5506e990224b78bdfb4ca737e (diff) | |
download | scummvm-rg350-dac4f23f8464a3a5df3feebb2b74297df6a01c11.tar.gz scummvm-rg350-dac4f23f8464a3a5df3feebb2b74297df6a01c11.tar.bz2 scummvm-rg350-dac4f23f8464a3a5df3feebb2b74297df6a01c11.zip |
FULLPIPE: Turned InventoryPoolItem into struct
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/inventory.cpp | 25 | ||||
-rw-r--r-- | engines/fullpipe/inventory.h | 22 |
2 files changed, 29 insertions, 18 deletions
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 03b7cbf8b7..588b465415 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -32,20 +32,29 @@ bool CInventory::load(MfcArchive &file) { for (int i = 0; i < numInvs; i++) { InventoryPoolItem *t = new InventoryPoolItem(); - t->_id = file.readUint16LE(); - t->_pictureObjectNormalId = file.readUint16LE(); - t->_pictureObjectId1 = file.readUint16LE(); - t->_pictureObjectMouseInsideId = file.readUint16LE(); - t->_pictureObjectId3 = file.readUint16LE(); - t->_flags = file.readUint32LE(); - t->_field_C = 0; - t->_field_A = -536; + t->id = file.readUint16LE(); + t->pictureObjectNormalId = file.readUint16LE(); + t->pictureObjectId1 = file.readUint16LE(); + t->pictureObjectMouseInsideId = file.readUint16LE(); + t->pictureObjectId3 = file.readUint16LE(); + t->flags = file.readUint32LE(); + t->field_C = 0; + t->field_A = -536; _itemsPool.push_back(*t); } return true; } +int CInventory::getInventoryPoolItemIndexById(int itemId) { + for (int i = 0; i < _itemsPool.size(); i++) { + if (_itemsPool[i].id == itemId) + return i; + } + + return 0; +} + CInventory2::CInventory2() { _selectedId = -1; _field_48 = -1; diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 8b6271aa1b..30b23c3c98 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -28,17 +28,17 @@ namespace Fullpipe { class Scene; class BigPicture; -class InventoryPoolItem { +struct InventoryPoolItem { public: - int16 _id; - int16 _pictureObjectNormalId; - int16 _pictureObjectId1; - int16 _pictureObjectMouseInsideId; - int16 _pictureObjectId3; - int16 _field_A; - int _field_C; - int _obj; - int _flags; + int16 id; + int16 pictureObjectNormalId; + int16 pictureObjectId1; + int16 pictureObjectMouseInsideId; + int16 pictureObjectId3; + int16 field_A; + int field_C; + int obj; + int flags; }; typedef Common::Array<InventoryPoolItem> InventoryPoolItems; @@ -51,6 +51,8 @@ class CInventory : public CObject { public: CInventory() { _sceneId = 0; } virtual bool load(MfcArchive &file); + + int getInventoryPoolItemIndexById(int itemId); }; struct InventoryItem { |