aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/inventory.cpp26
-rw-r--r--engines/parallaction/inventory.h5
-rw-r--r--engines/parallaction/parallaction.h4
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];