[Scummvm-cvs-logs] SF.net SVN: scummvm:[45042] scummvm/trunk/engines/sci/engine/savegame.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Oct 13 20:54:20 CEST 2009


Revision: 45042
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45042&view=rev
Author:   fingolfin
Date:     2009-10-13 18:54:20 +0000 (Tue, 13 Oct 2009)

Log Message:
-----------
SCI: Skip loading HunkTable segments. This fixes a silly bug that can lead to arbitrary numbers of HunkTable segments to be created by repeatedly saving and loading.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-10-13 18:53:50 UTC (rev 45041)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-10-13 18:54:20 UTC (rev 45042)
@@ -213,25 +213,30 @@
 		SegmentType type = (s.isSaving() && mobj) ? mobj->getType() : SEG_TYPE_INVALID;
 		s.syncAsUint32LE(type);
 
-		// Handle the OBSOLETE type SEG_TYPE_STRING_FRAG -- just ignore it
-		if (s.isLoading() && type == SEG_TYPE_STRING_FRAG) {
-			s.skip(4, VER(9), VER(9));	// OBSOLETE: Used to be _segManagerId
-			continue;
-		}
-
 		// If we were saving and mobj == 0, or if we are loading and this is an
 		// entry marked as empty -> skip to next
 		if (type == SEG_TYPE_INVALID) {
 			continue;
 		}
 
+		s.skip(4, VER(9), VER(9));	// OBSOLETE: Used to be _segManagerId
+
+		// Don't load HunkTable segments
+		if (s.isLoading() && type == SEG_TYPE_HUNK) {
+			continue;
+		}
+
+		// Handle the OBSOLETE type SEG_TYPE_STRING_FRAG -- just ignore it
+		if (s.isLoading() && type == SEG_TYPE_STRING_FRAG) {
+			continue;
+		}
+
+
 		if (s.isLoading()) {
 			mobj = SegmentObj::createSegmentObj(type);
 		}
 		assert(mobj);
 
-		s.skip(4, VER(9), VER(9));	// OBSOLETE: Used to be _segManagerId
-
 		// Let the object sync custom data
 		mobj->saveLoadWithSerializer(s);
 
@@ -244,6 +249,7 @@
 	s.syncAsSint32LE(Clones_seg_id);
 	s.syncAsSint32LE(Lists_seg_id);
 	s.syncAsSint32LE(Nodes_seg_id);
+// FIXME: Hunks_seg_id ?
 }
 
 static void sync_SegManagerPtr(Common::Serializer &s, ResourceManager *&resMan, SegManager *&obj) {
@@ -369,9 +375,7 @@
 }
 
 void HunkTable::saveLoadWithSerializer(Common::Serializer &s) {
-	if (s.isLoading()) {
-		initTable();
-	}
+	// Do nothing, hunk tables are not actually saved nor loaded.
 }
 
 void Script::saveLoadWithSerializer(Common::Serializer &s) {
@@ -550,6 +554,7 @@
 }
 
 // FIXME: This should probably be turned into an EngineState method
+// FIXME: Or maybe into a DataStack method...
 static void reconstruct_stack(EngineState *retval) {
 	SegmentId stack_seg = retval->_segMan->findSegmentByType(SEG_TYPE_STACK);
 	DataStack *stack = (DataStack *)(retval->_segMan->_heap[stack_seg]);


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