diff options
author | Gregory Montoir | 2007-05-19 21:16:31 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-05-19 21:16:31 +0000 |
commit | 4aa3ec63deae1dab4b04b7b7482472423e93119d (patch) | |
tree | 17496ded49cb7eb39b328bbb11fa4b8c06362e8c | |
parent | 3afd0d95576b2578b6d56fcc62c283a0c1261035 (diff) | |
download | scummvm-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
-rw-r--r-- | engines/cine/script.cpp | 8 |
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; |