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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jun 15 10:39:03 CEST 2010


Revision: 49688
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49688&view=rev
Author:   thebluegr
Date:     2010-06-15 08:39:03 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
- Swapped the return value of gamestate_save (false = failed, true = succeeded)
- Removed some duplicate code inside Console::cmdSaveGame()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/detection.cpp
    scummvm/trunk/engines/sci/engine/kfile.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/savegame.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-06-15 08:25:51 UTC (rev 49687)
+++ scummvm/trunk/engines/sci/console.cpp	2010-06-15 08:39:03 UTC (rev 49688)
@@ -1085,7 +1085,7 @@
 	}
 
 	// TODO: enable custom descriptions? force filename into a specific format?
-	if (gamestate_save(_engine->_gamestate, out, "debugging", version)) {
+	if (!gamestate_save(_engine->_gamestate, out, "debugging", version)) {
 		DebugPrintf("Saving the game state to '%s' failed\n", argv[1]);
 	} else {
 		out->finalize();
@@ -1095,14 +1095,6 @@
 		delete out;
 	}
 
-	out->finalize();
-        if (out->err()) {
-        	delete out;
-                warning("Writing the savegame failed.");
-        } else {
-                delete out;
-        }
-
 	return true;
 }
 

Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp	2010-06-15 08:25:51 UTC (rev 49687)
+++ scummvm/trunk/engines/sci/detection.cpp	2010-06-15 08:39:03 UTC (rev 49688)
@@ -659,7 +659,7 @@
 		return Common::kWritingFailed;
 	}
 
-	if (gamestate_save(_gamestate, out, desc, version)) {
+	if (!gamestate_save(_gamestate, out, desc, version)) {
 		warning("Saving the game state to '%s' failed", fileName.c_str());
 		return Common::kWritingFailed;
 	} else {

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2010-06-15 08:25:51 UTC (rev 49687)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2010-06-15 08:39:03 UTC (rev 49688)
@@ -543,7 +543,7 @@
 		return NULL_REG;
 	}
 
-	if (gamestate_save(s, out, game_description.c_str(), version.c_str())) {
+	if (!gamestate_save(s, out, game_description.c_str(), version.c_str())) {
 		warning("Saving the game failed.");
 		s->r_acc = NULL_REG;
 	} else {

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-15 08:25:51 UTC (rev 49687)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-15 08:39:03 UTC (rev 49688)
@@ -860,7 +860,7 @@
 #pragma mark -
 
 
-int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) {
+bool gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) {
 	TimeDate curTime;
 	g_system->getTimeAndDate(curTime);
 
@@ -877,7 +877,7 @@
 
 	if (s->executionStackBase) {
 		warning("Cannot save from below kernel function");
-		return 1;
+		return false;
 	}
 
 	Common::Serializer ser(0, fh);
@@ -885,7 +885,7 @@
 	Graphics::saveThumbnail(*fh);
 	s->saveLoadWithSerializer(ser);		// FIXME: Error handling?
 
-	return 0;
+	return true;
 }
 
 void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {

Modified: scummvm/trunk/engines/sci/engine/savegame.h
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.h	2010-06-15 08:25:51 UTC (rev 49687)
+++ scummvm/trunk/engines/sci/engine/savegame.h	2010-06-15 08:39:03 UTC (rev 49688)
@@ -59,7 +59,7 @@
  * @param savename	The description of the savegame
  * @return 0 on success, 1 otherwise
  */
-int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version);
+bool gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version);
 
 /**
  * Restores a game state from a directory.


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