diff options
author | Nicola Mettifogo | 2009-09-30 13:41:19 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-09-30 13:41:19 +0000 |
commit | 9be8a6e4f6c35c1bbad3b8f6af7f223e584b8954 (patch) | |
tree | f06b90b52b48ea2cc49a16c8b45ee225a2c72359 /engines/parallaction | |
parent | fa077237c1a48aa5b3b56f3697e775f5e05cb08c (diff) | |
download | scummvm-rg350-9be8a6e4f6c35c1bbad3b8f6af7f223e584b8954.tar.gz scummvm-rg350-9be8a6e4f6c35c1bbad3b8f6af7f223e584b8954.tar.bz2 scummvm-rg350-9be8a6e4f6c35c1bbad3b8f6af7f223e584b8954.zip |
Simplified inventory handling (too much information hiding will kill you).
svn-id: r44485
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/inventory.cpp | 26 | ||||
-rw-r--r-- | engines/parallaction/inventory.h | 5 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 4 |
3 files changed, 12 insertions, 23 deletions
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 2b9e63c9fa..f50451dc13 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -102,31 +102,31 @@ void Parallaction::highlightInventoryItem(ItemPosition pos) { } int Parallaction::addInventoryItem(ItemName item) { - return getActiveInventory()->addItem(item); + return _inventory->addItem(item); } int Parallaction::addInventoryItem(ItemName item, uint32 value) { - return getActiveInventory()->addItem(item, value); + return _inventory->addItem(item, value); } void Parallaction::dropItem(uint16 v) { - getActiveInventory()->removeItem(v); + _inventory->removeItem(v); } bool Parallaction::isItemInInventory(int32 v) { - return (getActiveInventory()->findItem(v) != -1); + return (_inventory->findItem(v) != -1); } const InventoryItem* Parallaction::getInventoryItem(int16 pos) { - return getActiveInventory()->getItem(pos); + return _inventory->getItem(pos); } int16 Parallaction::getInventoryItemIndex(int16 pos) { - return getActiveInventory()->getItemName(pos); + return _inventory->getItemName(pos); } void Parallaction::cleanInventory(bool keepVerbs) { - getActiveInventory()->clear(keepVerbs); + _inventory->clear(keepVerbs); } void Parallaction::openInventory() { @@ -140,7 +140,7 @@ void Parallaction::closeInventory() { -InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props) : _vm(vm), _props(props) { +InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props, Inventory *inv) : _vm(vm), _props(props), _inv(inv) { _surf.create(_props->_width, _props->_height, 1); } @@ -336,26 +336,20 @@ const InventoryItem* Inventory::getItem(ItemPosition pos) const { return &_items[pos]; } -Inventory *Parallaction::getActiveInventory() { - return _inventoryRenderer->getBoundInventory(); -} - void Parallaction_ns::initInventory() { _inventory = new Inventory(_invProps_NS._maxItems, _verbs_NS); assert(_inventory); - _inventoryRenderer = new InventoryRenderer(this, &_invProps_NS); + _inventoryRenderer = new InventoryRenderer(this, &_invProps_NS, _inventory); assert(_inventoryRenderer); - _inventoryRenderer->bindInventory(_inventory); } void Parallaction_br::initInventory() { _inventory = new Inventory(_invProps_BR._maxItems, _verbs_BR); assert(_inventory); - _inventoryRenderer = new InventoryRenderer(this, &_invProps_BR); + _inventoryRenderer = new InventoryRenderer(this, &_invProps_BR, _inventory); assert(_inventoryRenderer); - _inventoryRenderer->bindInventory(_inventory); _charInventories[0] = new Inventory(_invProps_BR._maxItems, _verbs_BR); _charInventories[1] = new Inventory(_invProps_BR._maxItems, _verbs_BR); diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index 11ebf57155..e4bb935672 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -101,12 +101,9 @@ protected: void refresh(); public: - InventoryRenderer(Parallaction *vm, InventoryProperties *props); + InventoryRenderer(Parallaction *vm, InventoryProperties *props, Inventory *inv); virtual ~InventoryRenderer(); - void bindInventory(Inventory *inv) { _inv = inv; } - Inventory *getBoundInventory() const { return _inv; } - void showInventory(); void hideInventory(); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 424c24fc37..c78c4824b7 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -298,6 +298,7 @@ public: BalloonManager *_balloonMan; DialogueManager *_dialogueMan; InventoryRenderer *_inventoryRenderer; + Inventory *_inventory; // inventory for the current character // game data Character _char; @@ -365,7 +366,6 @@ public: void cleanInventory(bool keepVerbs = true); void openInventory(); void closeInventory(); - Inventory *getActiveInventory(); virtual void parseLocation(const char* name) = 0; virtual void changeLocation() = 0; @@ -415,7 +415,6 @@ private: bool _inTestResult; LocationParser_ns *_locationParser; ProgramParser_ns *_programParser; - Inventory *_inventory; private: void initFonts(); @@ -547,7 +546,6 @@ private: LocationParser_br *_locationParser; ProgramParser_br *_programParser; SoundMan_br *_soundManI; - Inventory *_inventory; // inventory for the current character Inventory *_charInventories[3]; // all the inventories int32 _counters[32]; |