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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue May 19 02:02:45 CEST 2009


Revision: 40712
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40712&view=rev
Author:   fingolfin
Date:     2009-05-19 00:02:44 +0000 (Tue, 19 May 2009)

Log Message:
-----------
SCI: Init the diff .#&$ EngineState::flags field in the constructor and when loading -- fixes many weird crashes upon loading (lesson to be learned: if you add fields to a class, then (a) init it in the construtor and (b) if the class support serializing, make sure the new field is handled when saving/loading :-)

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

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-05-19 00:02:10 UTC (rev 40711)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-05-19 00:02:44 UTC (rev 40712)
@@ -251,7 +251,7 @@
 	s.syncAsSint32LE(savegame_version);
 
 	syncCStr(s, &game_version);
-	s.syncAsSint32LE(version);
+	s.skip(4);	// Obsolete: Used to be version
 
 	// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
 	if (s.isLoading()) {
@@ -758,6 +758,9 @@
 	// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
 	retval = new EngineState();
 
+	retval->version = s->version;
+	retval->flags = s->flags;
+
 	retval->savegame_version = -1;
 	retval->gfx_state = s->gfx_state;
 

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2009-05-19 00:02:10 UTC (rev 40711)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2009-05-19 00:02:44 UTC (rev 40712)
@@ -99,11 +99,12 @@
 	last_wait_time = 0;
 
 	version = 0;
+	flags = 0;
 
+	kernel_opt_flags = 0;
+
 	_fileHandles.resize(5);
 
-	kernel_opt_flags = 0;
-
 	execution_stack_base = 0;
 	_executionStackPosChanged = false;
 
@@ -119,14 +120,14 @@
 	parser_event = NULL_REG;
 	script_000 = 0;
 
-	string_frag_segment = 0;
-
 	parser_lastmatch_word = 0;
 	bp_list = 0;
 	have_bp = 0;
 	debug_mode = 0;
 	sys_strings_segment = 0;
 	sys_strings = 0;
+	string_frag_segment = 0;
+
 	parser_rules = 0;
 	memset(parser_nodes, 0, sizeof(parser_nodes));
 

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-05-19 00:02:10 UTC (rev 40711)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-05-19 00:02:44 UTC (rev 40712)
@@ -195,7 +195,7 @@
 	uint32 last_wait_time; /**< The last time the game invoked Wait() */
 
 	sci_version_t version; /**< The approximated patchlevel of the version to emulate */
-	uint32 flags;			/* Specific game flags */
+	uint32 flags;			/**< Specific game flags */
 
 	unsigned int kernel_opt_flags; /**< Kernel optimization flags- used for performance tweaking */
 


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