SCUMM: Refactor how resource (types) are srepresented

Previously, we had a couple of arrays of size N (where N = number of
resource types), one for each attribute of a resource type (such as as
the number of resources of that type.

Now, we have one array of size N, whose elements are a record
aggregating all the attributes of each resource type.
This commit is contained in:
Max Horn 2011-05-11 16:23:26 +02:00
parent b37463fe59
commit 45e65d7ea0
16 changed files with 157 additions and 152 deletions

View file

@ -192,8 +192,8 @@ void ScummEngine::clearOwnerOf(int obj) {
if (!_inventory[i] && _inventory[i+1]) {
_inventory[i] = _inventory[i+1];
_inventory[i+1] = 0;
_res->address[rtInventory][i] = _res->address[rtInventory][i + 1];
_res->address[rtInventory][i + 1] = NULL;
_res->_types[rtInventory].address[i] = _res->_types[rtInventory].address[i + 1];
_res->_types[rtInventory].address[i + 1] = NULL;
}
}
break;
@ -1796,7 +1796,7 @@ int ScummEngine::findLocalObjectSlot() {
int ScummEngine::findFlObjectSlot() {
int i;
for (i = 1; i < _numFlObject; i++) {
if (_res->address[rtFlObject][i] == NULL)
if (_res->_types[rtFlObject].address[i] == NULL)
return i;
}
error("findFlObjectSlot: Out of FLObject slots");