ZVISION: Remove zero valued entries in the global state table once a frame
This commit is contained in:
parent
dd307c2484
commit
9dd54a16e0
2 changed files with 15 additions and 0 deletions
|
@ -196,6 +196,17 @@ void ScriptManager::checkPuzzleCriteria() {
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptManager::cleanStateTable() {
|
||||
for (Common::HashMap<uint32, uint32>::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) {
|
||||
// If the value is equal to zero, we can purge it since getStateValue()
|
||||
// will return zero if _globalState doesn't contain a key
|
||||
if ((*iter)._value == 0) {
|
||||
// Remove the node
|
||||
_globalState.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint ScriptManager::getStateValue(uint32 key) {
|
||||
if (_globalState.contains(key))
|
||||
return _globalState[key];
|
||||
|
@ -285,6 +296,9 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
|
|||
// Reset the background velocity
|
||||
_engine->getRenderManager()->setBackgroundVelocity(0);
|
||||
|
||||
// Clean the global state table
|
||||
cleanStateTable();
|
||||
|
||||
// Parse into puzzles and controls
|
||||
Common::String fileName = Common::String::format("%c%c%c%c.scr", world, room, node, view);
|
||||
parseScrFile(fileName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue