aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2007-05-19 21:16:31 +0000
committerGregory Montoir2007-05-19 21:16:31 +0000
commit4aa3ec63deae1dab4b04b7b7482472423e93119d (patch)
tree17496ded49cb7eb39b328bbb11fa4b8c06362e8c /engines
parent3afd0d95576b2578b6d56fcc62c283a0c1261035 (diff)
downloadscummvm-rg350-4aa3ec63deae1dab4b04b7b7482472423e93119d.tar.gz
scummvm-rg350-4aa3ec63deae1dab4b04b7b7482472423e93119d.tar.bz2
scummvm-rg350-4aa3ec63deae1dab4b04b7b7482472423e93119d.zip
when reading a string from a script, skip the '\0' trailing char (less opcode '0' executions...)
svn-id: r26880
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/script.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/engines/cine/script.cpp b/engines/cine/script.cpp
index 3b2510c2e7..738ade2834 100644
--- a/engines/cine/script.cpp
+++ b/engines/cine/script.cpp
@@ -448,7 +448,7 @@ uint16 getNextWord() {
const char *getNextString() {
const char *val = (const char *)(_currentScriptPtr + _currentPosition);
- _currentPosition += strlen(val);
+ _currentPosition += strlen(val) + 1;
return val;
}
@@ -562,7 +562,7 @@ uint16 computeScriptStackSub(bool computeAllLabels, byte *scriptPtr, int16 *stac
while (position < scriptSize) {
uint8 opcode = scriptPtr[position];
position++;
- if (opcode == 0) {
+ if (opcode == 0 || opcode > _numOpcodes) {
continue;
}
if (!_opcodeTable[opcode - 1].args) {
@@ -600,9 +600,7 @@ uint16 computeScriptStackSub(bool computeAllLabels, byte *scriptPtr, int16 *stac
}
break;
case 's': // string
- do {
- position++;
- } while (scriptPtr[position] != 0);
+ while (scriptPtr[position++] != 0);
break;
case 'x': // exit script
return position;