[Scummvm-cvs-logs] SF.net SVN: scummvm:[44475] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Sep 30 09:09:07 CEST 2009


Revision: 44475
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44475&view=rev
Author:   peres001
Date:     2009-09-30 07:09:07 +0000 (Wed, 30 Sep 2009)

Log Message:
-----------
Provide only the data that is strictly needed when creating a new Inventory.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/inventory.cpp
    scummvm/trunk/engines/parallaction/inventory.h

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2009-09-30 04:33:52 UTC (rev 44474)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2009-09-30 07:09:07 UTC (rev 44475)
@@ -240,8 +240,8 @@
 
 }
 
-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 @@
 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 @@
 
 
 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 @@
 
 
 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_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);

Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h	2009-09-30 04:33:52 UTC (rev 44474)
+++ scummvm/trunk/engines/parallaction/inventory.h	2009-09-30 07:09:07 UTC (rev 44475)
@@ -64,10 +64,10 @@
 
 	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);


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