aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/script_v5.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 0c93bcf491..6abebf7fe6 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1446,7 +1446,15 @@ void ScummEngine_v5::o5_equalZero() {
}
void ScummEngine_v5::o5_jumpRelative() {
- _scriptPointer += (int16)fetchScriptWord();
+ // Note that calling fetchScriptWord() will also modify _scriptPointer,
+ // so *don't* do this: _scriptPointer += (int16)fetchScriptWord();
+ //
+ // I'm not enough of a language lawyer to say for certain that this is
+ // undefined, but I do know that GCC 4.0 doesn't think it means what
+ // we want it to mean.
+
+ int16 offset = (int16)fetchScriptWord();
+ _scriptPointer += offset;
}
void ScummEngine_v5::o5_lights() {