[Scummvm-cvs-logs] SF.net SVN: scummvm:[43000] scummvm/branches/branch-1-0-0/engines/tinsel/ saveload.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Aug 2 14:50:52 CEST 2009


Revision: 43000
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43000&view=rev
Author:   eriktorbjorn
Date:     2009-08-02 12:50:52 +0000 (Sun, 02 Aug 2009)

Log Message:
-----------
Backported: Show a message if saving or loading a game fails.

Modified Paths:
--------------
    scummvm/branches/branch-1-0-0/engines/tinsel/saveload.cpp

Modified: scummvm/branches/branch-1-0-0/engines/tinsel/saveload.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/engines/tinsel/saveload.cpp	2009-08-02 12:49:57 UTC (rev 42999)
+++ scummvm/branches/branch-1-0-0/engines/tinsel/saveload.cpp	2009-08-02 12:50:52 UTC (rev 43000)
@@ -37,6 +37,8 @@
 #include "common/serializer.h"
 #include "common/savefile.h"
 
+#include "gui/message.h"
+
 namespace Tinsel {
 
 
@@ -452,6 +454,11 @@
 
 	delete f;
 
+	if (failed) {
+		GUI::MessageDialog dialog("Failed to load game state from file.");
+		dialog.runModal();
+	}
+
 	return !failed;
 }
 
@@ -473,11 +480,11 @@
 	fname = SaveSceneName;
 
 	f = _vm->getSaveFileMan()->openForSaving(fname);
+	Common::Serializer s(0, f);
+
 	if (f == NULL)
-		return;
+		goto save_failure;
 
-	Common::Serializer s(0, f);
-
 	// Write out a savegame header
 	SaveGameHeader hdr;
 	hdr.id = SAVEGAME_ID;
@@ -502,8 +509,12 @@
 	return;
 
 save_failure:
-	delete f;
-	_vm->getSaveFileMan()->removeSavefile(fname);
+	if (f) {
+		delete f;
+		_vm->getSaveFileMan()->removeSavefile(fname);
+	}
+	GUI::MessageDialog dialog("Failed to save game state to file.");
+	dialog.runModal();
 }
 
 /**


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