[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.371,1.372

Max Horn fingolfin at users.sourceforge.net
Thu Aug 5 02:58:09 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23796

Modified Files:
	script_v6.cpp 
Log Message:
Aargh, my work around code was using a wrong check, and then using the wrong operations (which were effectively not doing anything)... Fixed the workaround code, which cures bug #918280 (and its dup #1003717)

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.371
retrieving revision 1.372
diff -u -d -r1.371 -r1.372
--- script_v6.cpp	5 Aug 2004 09:32:03 -0000	1.371
+++ script_v6.cpp	5 Aug 2004 09:57:36 -0000	1.372
@@ -483,6 +483,8 @@
 	return -1;
 }
 
+#define SWAP16(x)  x = SWAP_BYTES_16(x)
+
 ArrayHeader *ScummEngine_v6::getArray(int array) {
 	ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
 	if (!ah)
@@ -492,10 +494,10 @@
 	// endianness, instead of a fixed endianness. We try to detect savegames
 	// which were created on a big endian system and convert them to little
 	// endian.
-	if ((ah->dim1 & 0xF000) || (ah->dim2 & 0xF000) || (ah->type & 0xFF00)) {
-		SWAP_BYTES_16(ah->dim1);
-		SWAP_BYTES_16(ah->dim2);
-		SWAP_BYTES_16(ah->type);
+	if ((FROM_LE_16(ah->dim1) & 0xF000) || (FROM_LE_16(ah->dim2) & 0xF000) || (FROM_LE_16(ah->type) & 0xFF00)) {
+		SWAP16(ah->dim1);
+		SWAP16(ah->dim2);
+		SWAP16(ah->type);
 	}
 	
 	return ah;
@@ -519,7 +521,6 @@
 		return 0;
 	}
 
-
 	const int offset = base + idx * FROM_LE_16(ah->dim1);
 
 	if (offset < 0 || offset >= FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2)) {





More information about the Scummvm-git-logs mailing list