diff options
author | richiesams | 2013-09-03 23:53:30 -0500 |
---|---|---|
committer | richiesams | 2013-09-04 00:15:28 -0500 |
commit | 9dd54a16e00be09cf549e38b03387e28efe9195d (patch) | |
tree | 37d0f252bbe594a485e3f1944e7b27112458899d | |
parent | dd307c2484f7d251fa447bc6c05a3c4512928681 (diff) | |
download | scummvm-rg350-9dd54a16e00be09cf549e38b03387e28efe9195d.tar.gz scummvm-rg350-9dd54a16e00be09cf549e38b03387e28efe9195d.tar.bz2 scummvm-rg350-9dd54a16e00be09cf549e38b03387e28efe9195d.zip |
ZVISION: Remove zero valued entries in the global state table once a frame
-rw-r--r-- | engines/zvision/script_manager.cpp | 14 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index f3c945d658..45e1459293 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -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); diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 75be66c3f0..723f4fe032 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -114,6 +114,7 @@ private: void createReferenceTable(); void updateNodes(uint deltaTimeMillis); void checkPuzzleCriteria(); + void cleanStateTable(); // TODO: Make this private. It was only made public so Console::cmdParseAllScrFiles() could use it public: |