[Scummvm-cvs-logs] SF.net SVN: scummvm:[44485] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Wed Sep 30 15:41:19 CEST 2009
Revision: 44485
http://scummvm.svn.sourceforge.net/scummvm/?rev=44485&view=rev
Author: peres001
Date: 2009-09-30 13:41:19 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
Simplified inventory handling (too much information hiding will kill you).
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/inventory.cpp
scummvm/trunk/engines/parallaction/inventory.h
scummvm/trunk/engines/parallaction/parallaction.h
Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp 2009-09-30 13:09:18 UTC (rev 44484)
+++ scummvm/trunk/engines/parallaction/inventory.cpp 2009-09-30 13:41:19 UTC (rev 44485)
@@ -102,31 +102,31 @@
}
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 @@
-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 @@
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);
Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h 2009-09-30 13:09:18 UTC (rev 44484)
+++ scummvm/trunk/engines/parallaction/inventory.h 2009-09-30 13:41:19 UTC (rev 44485)
@@ -101,12 +101,9 @@
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();
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2009-09-30 13:09:18 UTC (rev 44484)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2009-09-30 13:41:19 UTC (rev 44485)
@@ -298,6 +298,7 @@
BalloonManager *_balloonMan;
DialogueManager *_dialogueMan;
InventoryRenderer *_inventoryRenderer;
+ Inventory *_inventory; // inventory for the current character
// game data
Character _char;
@@ -365,7 +366,6 @@
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 @@
bool _inTestResult;
LocationParser_ns *_locationParser;
ProgramParser_ns *_programParser;
- Inventory *_inventory;
private:
void initFonts();
@@ -547,7 +546,6 @@
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];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list