[Scummvm-cvs-logs] CVS: scummvm/scumm saveload.cpp,1.141,1.142

Max Horn fingolfin at users.sourceforge.net
Tue Feb 17 09:53:02 CET 2004


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

Modified Files:
	saveload.cpp 
Log Message:
delete certain unused non-perma resources when loading

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- saveload.cpp	17 Feb 2004 00:40:51 -0000	1.141
+++ saveload.cpp	17 Feb 2004 17:43:27 -0000	1.142
@@ -183,7 +183,7 @@
 	// scumm vars. We now know the proper locations. To be able to properly use
 	// old save games, we update the old (bad) variables to the new (correct)
 	// ones.
-	if (hdr.ver < 28 && _version == 8) {
+	if (hdr.ver < VER(28) && _version == 8) {
 		_scummVars[VAR_CAMERA_MIN_X] = _scummVars[101];
 		_scummVars[VAR_CAMERA_MAX_X] = _scummVars[102];
 		_scummVars[VAR_CAMERA_MIN_Y] = _scummVars[103];
@@ -657,6 +657,18 @@
 
 	// Save all resource.
 	int type, idx;
+
+	if (s->isLoading()) {
+		// When loading, start by deleting old non-permanent resources (an
+		// exception is made for buffer/temp resources, they are going to be
+		// deleted later on anyway).
+		for (type = rtFirst; type <= rtLast; type++) {
+			if (res.mode[type] != 1 && type != rtTemp && type != rtBuffer)
+				for (idx = 1; idx < res.num[type]; idx++)
+					nukeResource(type, idx);
+		}
+	}
+
 	if (savegameVersion >= VER(26)) {
 		// New, more robust resource save/load system. This stores the type
 		// and index of each resource. Thus if we increase e.g. the maximum
@@ -689,10 +701,9 @@
 		// with index 0, and breaks whenever we change the limit on a given
 		// resource type.
 		for (type = rtFirst; type <= rtLast; type++)
-			if (res.mode[type] != 1)
+			if (res.mode[type] != 1 && type != rtTemp && type != rtBuffer)
 				for (idx = 1; idx < res.num[type]; idx++)
-					if (type != rtTemp && type != rtBuffer)
-						saveLoadResource(s, type, idx);
+					saveLoadResource(s, type, idx);
 	}
 
 	s->saveLoadArrayOf(_objectOwnerTable, _numGlobalObjects, sizeof(_objectOwnerTable[0]), sleByte);





More information about the Scummvm-git-logs mailing list