aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/script.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp
index b1b7e8cbd5..37f6bb8e0c 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -217,20 +217,19 @@ void Scumm::stopScript(int script) {
}
}
- if (_numNestedScripts == 0)
- return;
-
nest = vm.nest;
num = _numNestedScripts;
- do {
+ while (num > 0) {
if (nest->number == script &&
(nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) {
nest->number = 0xFF;
nest->slot = 0xFF;
nest->where = 0xFF;
}
- } while (nest++, --num);
+ nest++;
+ num--;
+ }
}
/* Stop an object script 'script'*/
@@ -255,20 +254,19 @@ void Scumm::stopObjectScript(int script) {
}
}
- if (_numNestedScripts == 0)
- return;
-
nest = vm.nest;
num = _numNestedScripts;
- do {
+ while (num > 0) {
if (nest->number == script &&
(nest->where == WIO_ROOM || nest->where == WIO_INVENTORY || nest->where == WIO_FLOBJECT)) {
nest->number = 0xFF;
nest->slot = 0xFF;
nest->where = 0xFF;
}
- } while (nest++, --num);
+ nest++;
+ num--;
+ }
}
/* Return a free script slot */