[Scummvm-cvs-logs] SF.net SVN: scummvm: [26880] scummvm/trunk/engines/cine/script.cpp

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sat May 19 23:16:32 CEST 2007


Revision: 26880
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26880&view=rev
Author:   cyx
Date:     2007-05-19 14:16:31 -0700 (Sat, 19 May 2007)

Log Message:
-----------
when reading a string from a script, skip the '\0' trailing char (less opcode '0' executions...)

Modified Paths:
--------------
    scummvm/trunk/engines/cine/script.cpp

Modified: scummvm/trunk/engines/cine/script.cpp
===================================================================
--- scummvm/trunk/engines/cine/script.cpp	2007-05-19 21:12:10 UTC (rev 26879)
+++ scummvm/trunk/engines/cine/script.cpp	2007-05-19 21:16:31 UTC (rev 26880)
@@ -448,7 +448,7 @@
 
 const char *getNextString() {
 	const char *val = (const char *)(_currentScriptPtr + _currentPosition);
-	_currentPosition += strlen(val);
+	_currentPosition += strlen(val) + 1;
 	return val;
 }
 
@@ -562,7 +562,7 @@
 	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 @@
 				}
 				break;
 			case 's': // string
-				do {
-					position++;
-				} while (scriptPtr[position] != 0);
+				while (scriptPtr[position++] != 0);
 				break;
 			case 'x': // exit script
 				return position;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list