aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2009-09-30 07:09:07 +0000
committerNicola Mettifogo2009-09-30 07:09:07 +0000
commite660f31ed896e487dba5783619840cc065cc1bc5 (patch)
tree4bc09c2012586bbe027d4e19b882e19a26e39a20 /engines/parallaction
parent76a0bcb6c4a523c5a5b312ece3cb2bab359ab4a9 (diff)
downloadscummvm-rg350-e660f31ed896e487dba5783619840cc065cc1bc5.tar.gz
scummvm-rg350-e660f31ed896e487dba5783619840cc065cc1bc5.tar.bz2
scummvm-rg350-e660f31ed896e487dba5783619840cc065cc1bc5.zip
Provide only the data that is strictly needed when creating a new Inventory.
svn-id: r44475
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/inventory.cpp12
-rw-r--r--engines/parallaction/inventory.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index b9d702ea5c..5283fe23fb 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -240,8 +240,8 @@ void InventoryRenderer::getItemRect(ItemPosition pos, Common::Rect &r) {
}
-Inventory::Inventory(InventoryProperties *props, InventoryItem *verbs) : _numItems(0), _props(props) {
- _items = (InventoryItem*)calloc(_props->_maxItems, sizeof(InventoryItem));
+Inventory::Inventory(int maxItems, InventoryItem *verbs) : _numItems(0), _maxItems(maxItems) {
+ _items = (InventoryItem*)calloc(_maxItems, sizeof(InventoryItem));
int i = 0;
for ( ; verbs[i]._id; i++) {
@@ -258,7 +258,7 @@ Inventory::~Inventory() {
ItemPosition Inventory::addItem(ItemName name, uint32 value) {
debugC(1, kDebugInventory, "addItem(%i, %i)", name, value);
- if (_numItems == _props->_maxItems) {
+ if (_numItems == _maxItems) {
debugC(3, kDebugInventory, "addItem: inventory is full");
return -1;
}
@@ -329,7 +329,7 @@ void Inventory::clear(bool keepVerbs) {
ItemName Inventory::getItemName(ItemPosition pos) const {
- return (pos >= 0 && pos < _props->_maxItems) ? _items[pos]._index : 0;
+ return (pos >= 0 && pos < _maxItems) ? _items[pos]._index : 0;
}
const InventoryItem* Inventory::getItem(ItemPosition pos) const {
@@ -343,7 +343,7 @@ Inventory *Parallaction::getActiveInventory() {
void Parallaction_ns::initInventory() {
- _inventory = new Inventory(&_invProps_NS, _verbs_NS);
+ _inventory = new Inventory(_invProps_NS._maxItems, _verbs_NS);
assert(_inventory);
_inventoryRenderer = new InventoryRenderer(this, &_invProps_NS);
assert(_inventoryRenderer);
@@ -351,7 +351,7 @@ void Parallaction_ns::initInventory() {
}
void Parallaction_br::initInventory() {
- _inventory = new Inventory(&_invProps_BR, _verbs_BR);
+ _inventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
assert(_inventory);
_inventoryRenderer = new InventoryRenderer(this, &_invProps_BR);
assert(_inventoryRenderer);
diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h
index a9424d9186..11ebf57155 100644
--- a/engines/parallaction/inventory.h
+++ b/engines/parallaction/inventory.h
@@ -64,10 +64,10 @@ protected:
InventoryItem *_items;
uint16 _numItems;
- InventoryProperties *_props;
+ int _maxItems;
public:
- Inventory(InventoryProperties *props, InventoryItem *verbs);
+ Inventory(int maxItems, InventoryItem *verbs);
virtual ~Inventory();
ItemPosition addItem(ItemName name, uint32 value);