[Scummvm-cvs-logs] SF.net SVN: scummvm: [26987] scummvm/trunk/engines/scumm

sev at users.sourceforge.net sev at users.sourceforge.net
Mon May 28 10:02:11 CEST 2007


Revision: 26987
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26987&view=rev
Author:   sev
Date:     2007-05-28 01:02:10 -0700 (Mon, 28 May 2007)

Log Message:
-----------
Improved version of patch to fix bug #1722153: "FT: Error on loading a game saved during a dialogue"

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/charset.cpp
    scummvm/trunk/engines/scumm/charset.h
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/saveload.h

Modified: scummvm/trunk/engines/scumm/charset.cpp
===================================================================
--- scummvm/trunk/engines/scumm/charset.cpp	2007-05-28 01:11:43 UTC (rev 26986)
+++ scummvm/trunk/engines/scumm/charset.cpp	2007-05-28 08:02:10 UTC (rev 26987)
@@ -1311,7 +1311,21 @@
 	}
 }
 
+void CharsetRenderer::saveLoadWithSerializer(Serializer *ser) {
+	static const SaveLoadEntry charsetRendererEntries[] = {
+		MKLINE(CharsetRenderer, _curId, sleByte, VER(73)),
+		MKLINE(CharsetRenderer, _color, sleByte, VER(73)),
+		MKEND()
+	};
 
+	ser->saveLoadEntries(this, charsetRendererEntries);
+
+	if (ser->isLoading()) {
+		setCurID(_curId);
+		setColor(_color);
+	}
+}
+
 void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
 	int width, height, origWidth, origHeight;
 	int offsX, offsY;

Modified: scummvm/trunk/engines/scumm/charset.h
===================================================================
--- scummvm/trunk/engines/scumm/charset.h	2007-05-28 01:11:43 UTC (rev 26986)
+++ scummvm/trunk/engines/scumm/charset.h	2007-05-28 08:02:10 UTC (rev 26987)
@@ -25,6 +25,7 @@
 #include "common/scummsys.h"
 #include "common/rect.h"
 #include "scumm/gfx.h"
+#include "scumm/saveload.h"
 
 namespace Scumm {
 
@@ -84,6 +85,8 @@
 	virtual int getCharWidth(byte chr) = 0;
 
 	virtual void setColor(byte color) { _color = color; translateColor(); }
+
+	void saveLoadWithSerializer(Serializer *ser);
 };
 
 class CharsetRendererCommon : public CharsetRenderer {

Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2007-05-28 01:11:43 UTC (rev 26986)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2007-05-28 08:02:10 UTC (rev 26987)
@@ -1156,11 +1156,16 @@
 	//
 	// Save/load the charset renderer state
 	//
-	if (s->getVersion() >= VER(72)) {
-		if (s->isSaving()) {
-			s->saveByte(_charset->getCurID());
+	if (s->getVersion() >= VER(73)) {
+		_charset->saveLoadWithSerializer(s);
+	} else if (s->isLoading()) {
+		if (s->getVersion() == VER(72)) {
+			_charset->setCurID(s->loadByte());
 		} else {
-			_charset->setCurID(s->loadByte());
+			// Before V72, the charset id wasn't saved. This used to cause issues such
+			// as the one described in the bug report #1722153. For these savegames,
+			// we reinitialize the id using a, hopefully, sane value.
+			_charset->setCurID(_string[0]._default.charset);
 		}
 	}
 }

Modified: scummvm/trunk/engines/scumm/saveload.h
===================================================================
--- scummvm/trunk/engines/scumm/saveload.h	2007-05-28 01:11:43 UTC (rev 26986)
+++ scummvm/trunk/engines/scumm/saveload.h	2007-05-28 08:02:10 UTC (rev 26987)
@@ -47,7 +47,7 @@
  * only saves/loads those which are valid for the version of the savegame
  * which is being loaded/saved currently.
  */
-#define CURRENT_VER 72
+#define CURRENT_VER 73
 
 /**
  * An auxillary macro, used to specify savegame versions. We use this instead


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