[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.285,1.286

Max Horn fingolfin at users.sourceforge.net
Sat Nov 27 09:05:16 CET 2004


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

Modified Files:
	resource.cpp 
Log Message:
Reduce code duplication

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -d -r1.285 -r1.286
--- resource.cpp	27 Nov 2004 02:26:21 -0000	1.285
+++ resource.cpp	27 Nov 2004 13:10:41 -0000	1.286
@@ -1958,35 +1958,20 @@
 }
 
 byte *ScummEngine::getStringAddress(int i) {
-	byte *b = getResourceAddress(rtString, i);
-	if (!b)
+	byte *addr = getResourceAddress(rtString, i);
+	if (addr == NULL)
 		return NULL;
 
 	if (_heversion >= 72)
-		return (b + 0x14); // ArrayHeader->data
+		return (addr + 0x14);	// ArrayHeader->data
 
 	if (_features & GF_NEW_OPCODES)
-		return ((ArrayHeader *)b)->data;
-	return b;
+		return (addr + 0x6);	// ArrayHeader->data
+	return addr;
 }
 
 byte *ScummEngine::getStringAddressVar(int i) {
-	byte *addr;
-
-	addr = getResourceAddress(rtString, _scummVars[i]);
-	if (addr == NULL)
-		// as this is used for string mapping in the gui
-		// it must be allowed to return NULL
-		// error("NULL string var %d slot %d", i, _scummVars[i]);
-		return NULL;
-
-	if (_heversion >= 72)
-		return (addr + 0x14); // ArrayHeader->data
-
-	if (_features & GF_NEW_OPCODES)
-		return ((ArrayHeader *)addr)->data;
-
-	return (addr);
+	return getStringAddress(_scummVars[i]);
 }
 
 void ScummEngine::setResourceCounter(int type, int idx, byte flag) {





More information about the Scummvm-git-logs mailing list