mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-23 18:24:59 +00:00
ZVISION: Move the criteriaMet bool outside of the loop
Only fire off the Results of ALL of the criteria are met
This commit is contained in:
parent
c22c91b7d3
commit
48a3a1530d
@ -77,10 +77,10 @@ void ScriptManager::updateNodes(uint32 deltaTimeMillis) {
|
||||
void ScriptManager::checkPuzzleCriteria() {
|
||||
while (!_puzzlesToCheck.empty()) {
|
||||
Puzzle *puzzle = _puzzlesToCheck.pop();
|
||||
// Check each Criteria
|
||||
for (Common::List<Criteria>::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) {
|
||||
bool criteriaMet = false;
|
||||
|
||||
// Check each Criteria
|
||||
bool criteriaMet = false;
|
||||
for (Common::List<Criteria>::iterator iter = puzzle->criteriaList.begin(); iter != puzzle->criteriaList.end(); iter++) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user