From e23e1aa1f6e3ffb26774493eed7e2558d69fce99 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 7 Jul 2005 06:45:33 +0000 Subject: This allows ScummVM to run pre-Dig/FT SCUMM games again when compiled with GCC 4.0, at least for me. I'm not enough of a language lawyer to say for certain whether the old code was really undefined, but it's a simple enough change that shouldn't possibly do any harm. svn-id: r18507 --- scumm/script_v5.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scumm/script_v5.cpp') 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() { -- cgit v1.2.3