diff options
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/script_manager.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 7fcf2f67a3..85c900bc0e 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -77,10 +77,10 @@ void ScriptManager::updateNodes(uint32 deltaTimeMillis) { void ScriptManager::checkPuzzleCriteria() { while (!_puzzlesToCheck.empty()) { Puzzle *puzzle = _puzzlesToCheck.pop(); + // Check each Criteria + bool criteriaMet = false; for (Common::List<Criteria>::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) { - bool criteriaMet = false; - // Get the value to compare against byte argumentValue; if ((*iter).argument) @@ -104,11 +104,16 @@ void ScriptManager::checkPuzzleCriteria() { break; } - // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) - if (criteriaMet) { - for (Common::List<ResultAction *>::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { - (*resultIter)->execute(_engine); - } + if (!criteriaMet) { + break; + } + } + + // TODO: Add logic for the different Flags (aka, ONCE_PER_INST) + // criteriaList can be empty. Aka, the puzzle should be executed immediately + if (puzzle->criteriaList.empty() || criteriaMet) { + for (Common::List<ResultAction *>::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) { + (*resultIter)->execute(_engine); } } } |