[Scummvm-cvs-logs] SF.net SVN: scummvm: [22165] scummvm/trunk/base

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Apr 25 18:00:18 CEST 2006


Revision: 22165
Author:   sev
Date:     2006-04-25 17:59:13 -0700 (Tue, 25 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22165&view=rev

Log Message:
-----------
Introduce and use Engine_Empty() and Engine::GUIErrorMessage()

Modified Paths:
--------------
    scummvm/trunk/base/engine.cpp
    scummvm/trunk/base/engine.h
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/engines/simon/simon.cpp
Modified: scummvm/trunk/base/engine.cpp
===================================================================
--- scummvm/trunk/base/engine.cpp	2006-04-25 23:31:11 UTC (rev 22164)
+++ scummvm/trunk/base/engine.cpp	2006-04-26 00:59:13 UTC (rev 22165)
@@ -248,3 +248,18 @@
 	}
 #endif
 }
+
+void Engine::GUIErrorMessage(const Common::String msg) {
+	_system->setWindowCaption("Error");
+	_system->beginGFXTransaction();
+		initCommonGFX(false);
+		_system->initSize(320, 200, 2);
+	_system->endGFXTransaction();
+
+	GUI::MessageDialog dialog(msg);
+	dialog.runModal();
+}
+
+Engine_Empty::Engine_Empty(OSystem *syst, const Common::String msg) : Engine(syst), _message(msg) {
+}
+

Modified: scummvm/trunk/base/engine.h
===================================================================
--- scummvm/trunk/base/engine.h	2006-04-25 23:31:11 UTC (rev 22164)
+++ scummvm/trunk/base/engine.h	2006-04-26 00:59:13 UTC (rev 22165)
@@ -77,8 +77,32 @@
 
 	/* Indicate if an autosave should be performed */
 	bool shouldPerformAutoSave(int lastSaveTime);
+
+	/** Initialized graphics and shows error message */
+	void GUIErrorMessage(const Common::String msg);
 };
 
+// Used when no valid game was found in the directory
+// Just pops up an error message and returns to launcher
+class Engine_Empty : public Engine {
+public:
+	Engine_Empty(OSystem *syst, const Common::String msg = "No valid games were found in specified directory.");
+	virtual ~Engine_Empty() {}
+
+	// Displays error message
+	int init() { GUIErrorMessage(_message); return 0; }
+
+	// Just indicate that we want return to launcher
+	int go() { return 1; }
+
+	void errorString(char *buf_input, char *buf_output) {}
+
+private:
+	Common::String _message;
+};
+
+
+
 extern Engine *g_engine;
 
 #endif

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2006-04-25 23:31:11 UTC (rev 22164)
+++ scummvm/trunk/engines/saga/saga.cpp	2006-04-26 00:59:13 UTC (rev 22165)
@@ -53,8 +53,6 @@
 #include "saga/objectmap.h"
 #include "saga/resnames.h"
 
-#include "gui/message.h"
-
 namespace Saga {
 
 #define MAX_TIME_DELTA 100
@@ -162,13 +160,7 @@
 
 	// Detect game and open resource files
 	if (!initGame()) {
-		_system->beginGFXTransaction();
-			initCommonGFX(false);
-			_system->initSize(320, 200, 2);
-		_system->endGFXTransaction();
-		GUI::MessageDialog dialog("No valid games were found in the specified directory.");
-		dialog.runModal();
-
+		GUIErrorMessage("No valid games were found in the specified directory.");
 		return FAILURE;
 	}
 

Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-04-25 23:31:11 UTC (rev 22164)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-04-26 00:59:13 UTC (rev 22165)
@@ -1314,7 +1314,7 @@
 	// Unable to locate game data
 	if (results.empty()) {
 		warning("ScummEngine: unable to locate game data");
-		return 0;
+		return new Engine_Empty(syst);
 	}
 
 	DetectorResult res(*(results.begin()));

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-25 23:31:11 UTC (rev 22164)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-26 00:59:13 UTC (rev 22165)
@@ -31,7 +31,6 @@
 #include "common/system.h"
 
 #include "gui/about.h"
-#include "gui/message.h"
 
 #include "simon/simon.h"
 #include "simon/intern.h"
@@ -404,13 +403,7 @@
 
 	// Detect game
 	if (!initGame()) {
-		_system->beginGFXTransaction();
-			initCommonGFX(false);
-			_system->initSize(320, 200, 2);
-		_system->endGFXTransaction();
-		GUI::MessageDialog dialog("No valid games were found in the specified directory.");
-		dialog.runModal();
-
+		GUIErrorMessage("No valid games were found in the specified directory.");
 		return -1;
 	}
 


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