[Scummvm-cvs-logs] scummvm master -> 5ae2543795433513e68339b16e0783d4b3295204

clone2727 clone2727 at gmail.com
Fri Mar 16 21:18:17 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2f6528933d MOHAWK: Improve Riven save/load error messages
5ae2543795 MOHAWK: Disable Riven demo save/load GUI buttons


Commit: 2f6528933d8061881c81ac87b0028fb4368dbcc9
    https://github.com/scummvm/scummvm/commit/2f6528933d8061881c81ac87b0028fb4368dbcc9
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-03-16T13:03:14-07:00

Commit Message:
MOHAWK: Improve Riven save/load error messages

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven_saveload.cpp
    engines/mohawk/riven_saveload.h



diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 38b38d2..95a8313 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -171,7 +171,7 @@ Common::Error MohawkEngine_Riven::run() {
 			error ("Could not find saved game");
 
 		// Attempt to load the game. On failure, just send us to the main menu.
-		if (!_saveLoad->loadGame(savedGamesList[gameToLoad])) {
+		if (_saveLoad->loadGame(savedGamesList[gameToLoad]).getCode() != Common::kNoError) {
 			changeToStack(aspit);
 			changeToCard(1);
 		}
@@ -729,7 +729,7 @@ void MohawkEngine_Riven::runLoadDialog() {
 }
 
 Common::Error MohawkEngine_Riven::loadGameState(int slot) {
-	return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]) ? Common::kNoError : Common::kUnknownError;
+	return _saveLoad->loadGame(_saveLoad->generateSaveGameList()[slot]);
 }
 
 Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
@@ -738,7 +738,7 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
 	if ((uint)slot < saveList.size())
 		_saveLoad->deleteSave(saveList[slot]);
 
-	return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError;
+	return _saveLoad->saveGame(desc);
 }
 
 Common::String MohawkEngine_Riven::getStackName(uint16 stack) const {
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index 18c13ec..f5bf778 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -88,13 +88,13 @@ static uint16 mapNewStackIDToOld(uint16 newID) {
 	return 0;
 }
 
-bool RivenSaveLoad::loadGame(Common::String filename) {
+Common::Error RivenSaveLoad::loadGame(Common::String filename) {
 	if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo
-		return false;
+		return Common::kNoError;
 
 	Common::InSaveFile *loadFile =  _saveFileMan->openForLoading(filename);
 	if (!loadFile)
-		return false;
+		return Common::kReadingFailed;
 
 	debug(0, "Loading game from \'%s\'", filename.c_str());
 
@@ -103,7 +103,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
 	if (!mhk->openStream(loadFile)) {
 		warning("Save file is not a Mohawk archive");
 		delete mhk;
-		return false;
+		return Common::Error(Common::kUnknownError, "Invalid save file");
 	}
 
 	// First, let's make sure we're using a saved game file from this version of Riven by checking the VERS resource
@@ -114,7 +114,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
 		|| (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) {
 		warning("Incompatible saved game versions. No support for this yet");
 		delete mhk;
-		return false;
+		return Common::Error(Common::kUnknownError, "Incompatible save version");
 	}
 
 	// Now, we'll read in the variable values.
@@ -206,7 +206,7 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
 	delete zips;
 	delete mhk;
 
-	return true;
+	return Common::kNoError;
 }
 
 Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
@@ -273,7 +273,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
 	return stream;
 }
 
-bool RivenSaveLoad::saveGame(Common::String filename) {
+Common::Error RivenSaveLoad::saveGame(Common::String filename) {
 	// NOTE: This code is designed to only output a Mohawk archive
 	// for a Riven saved game. It's hardcoded to do this because
 	// (as of right now) this is the only place in the engine
@@ -295,7 +295,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
 
 	Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
 	if (!saveFile)
-		return false;
+		return Common::kWritingFailed;
 
 	debug (0, "Saving game to \'%s\'", filename.c_str());
 
@@ -418,7 +418,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) {
 	delete varsSection;
 	delete zipsSection;
 
-	return true;
+	return Common::kNoError;
 }
 
 void RivenSaveLoad::deleteSave(Common::String saveName) {
diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h
index c1b3fc6..37b73c2 100644
--- a/engines/mohawk/riven_saveload.h
+++ b/engines/mohawk/riven_saveload.h
@@ -42,8 +42,8 @@ public:
 	~RivenSaveLoad();
 
 	Common::StringArray generateSaveGameList();
-	bool loadGame(Common::String);
-	bool saveGame(Common::String);
+	Common::Error loadGame(Common::String);
+	Common::Error saveGame(Common::String);
 	void deleteSave(Common::String);
 
 private:


Commit: 5ae2543795433513e68339b16e0783d4b3295204
    https://github.com/scummvm/scummvm/commit/5ae2543795433513e68339b16e0783d4b3295204
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-03-16T13:16:25-07:00

Commit Message:
MOHAWK: Disable Riven demo save/load GUI buttons

Changed paths:
    engines/mohawk/detection_tables.h
    engines/mohawk/riven.h



diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 08df0a2..5acc1bb 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -376,7 +376,7 @@ static const MohawkGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformWindows,
 			ADGF_DEMO | ADGF_UNSTABLE,
-			GUIO1(GUIO_NOASPECT)
+			GUIO2(GUIO_NOASPECT, GUIO_NOLAUNCHLOAD)
 		},
 		GType_RIVEN,
 		GF_DEMO,
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index e99a9f7..961d85d 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -130,8 +130,8 @@ public:
 
 	GUI::Debugger *getDebugger();
 
-	bool canLoadGameStateCurrently() { return true; }
-	bool canSaveGameStateCurrently() { return true; }
+	bool canLoadGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
+	bool canSaveGameStateCurrently() { return !(getFeatures() & GF_DEMO); }
 	Common::Error loadGameState(int slot);
 	Common::Error saveGameState(int slot, const Common::String &desc);
 	bool hasFeature(EngineFeature f) const;






More information about the Scummvm-git-logs mailing list