aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichiesams2013-07-29 21:52:27 -0500
committerrichiesams2013-08-04 13:32:51 -0500
commit48a3a1530db615baf2388eb16118facb79f0a28a (patch)
tree085dc9658a576c8c49a269596acb0a03cf03fd12
parentc22c91b7d3056fdbb100b3b0fd6bda1aa8626b79 (diff)
downloadscummvm-rg350-48a3a1530db615baf2388eb16118facb79f0a28a.tar.gz
scummvm-rg350-48a3a1530db615baf2388eb16118facb79f0a28a.tar.bz2
scummvm-rg350-48a3a1530db615baf2388eb16118facb79f0a28a.zip
ZVISION: Move the criteriaMet bool outside of the loop
Only fire off the Results of ALL of the criteria are met
-rw-r--r--engines/zvision/script_manager.cpp19
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);
}
}
}