[Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.41,1.42 saveload.h,1.7,1.8 script_v8.cpp,2.102,2.103

Max Horn fingolfin at users.sourceforge.net
Thu Jan 9 14:54:02 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv2944/scumm

Modified Files:
	saveload.cpp saveload.h script_v8.cpp 
Log Message:
fixed the 'too many verbs' bug: verbid is 16 bits but was stored in save games as a byte. This means that existing savegames are still affected by the bug

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- saveload.cpp	31 Dec 2002 14:59:05 -0000	1.41
+++ saveload.cpp	9 Jan 2003 22:53:21 -0000	1.42
@@ -322,7 +322,10 @@
 		MKLINE(VerbSlot, oldtop, sleInt16, VER_V8),
 		MKLINE(VerbSlot, oldright, sleInt16, VER_V8),
 		MKLINE(VerbSlot, oldbottom, sleInt16, VER_V8),
-		MKLINE(VerbSlot, verbid, sleByte, VER_V8),
+
+		MKLINE_OLD(VerbSlot, verbid, sleByte, VER_V8, VER_V11),
+		MKLINE(VerbSlot, verbid, sleInt16, VER_V12),
+
 		MKLINE(VerbSlot, color, sleByte, VER_V8),
 		MKLINE(VerbSlot, hicolor, sleByte, VER_V8),
 		MKLINE(VerbSlot, dimcolor, sleByte, VER_V8),

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- saveload.h	21 Dec 2002 20:10:47 -0000	1.7
+++ saveload.h	9 Jan 2003 22:53:21 -0000	1.8
@@ -25,13 +25,14 @@
 // Support for "old" savegames (made with 2501 CVS build)
 // Can be useful for other ports too :)
 
+#define VER_V12 12
 #define VER_V11 11
 #define VER_V10 10
 #define VER_V9 9
 #define VER_V8 8
 #define VER_V7 7
 
-#define CURRENT_VER VER_V11
+#define CURRENT_VER VER_V12
 
 
 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.102
retrieving revision 2.103
diff -u -d -r2.102 -r2.103
--- script_v8.cpp	9 Jan 2003 17:06:30 -0000	2.102
+++ script_v8.cpp	9 Jan 2003 22:53:21 -0000	2.103
@@ -37,7 +37,6 @@
 
 void Scumm_v8::setupOpcodes()
 {
-	// TODO: any of the o6_ entries are potentially wrong and pure guesses :-)
 	static const OpcodeEntryV8 opcodes[256] = {
 		/* 00 */
 		OPCODE(o6_invalid),
@@ -1154,16 +1153,21 @@
 
 	_verbRedraw = true;
 
-	if (0 <= _curVerbSlot && _curVerbSlot < _maxVerbs)
-		vs = &_verbs[_curVerbSlot];
-	if (subOp != 0x96)
-		assert(vs);
-
-	switch (subOp) {
-	case 0x96:		// SO_VERB_INIT Choose verb number for editing
+	if (subOp == 0x96) {
 		_curVerb = pop();
 		_curVerbSlot = getVerbSlot(_curVerb, 0);
 		checkRange(_maxVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
+		//printf("Setting current actor to %d\n", _curActor);
+		return;
+	}
+	
+	assert(0 <= _curVerbSlot && _curVerbSlot < _maxVerbs);
+	vs = &_verbs[_curVerbSlot];
+	assert(vs);
+
+	switch (subOp) {
+	case 0x96:		// SO_VERB_INIT Choose verb number for editing
+		// handled above!
 		break;
 	case 0x97:		// SO_VERB_NEW New verb
 		if (_curVerbSlot == 0) {
@@ -1171,9 +1175,8 @@
 				if (_verbs[slot].verbid == 0)
 					break;
 			}
-			if (slot == _maxVerbs) {
-				warning("Too many verbs");
-				break;
+			if (slot >= _maxVerbs) {
+				error("Too many verbs");
 			}
 			_curVerbSlot = slot;
 		}





More information about the Scummvm-git-logs mailing list