[Scummvm-cvs-logs] CVS: scummvm/base main.cpp,1.77,1.78

Max Horn fingolfin at users.sourceforge.net
Thu May 5 05:04:41 CEST 2005


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4084/base

Modified Files:
	main.cpp 
Log Message:
Handle engine creation failure a bit more graceful

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- main.cpp	24 Apr 2005 12:21:52 -0000	1.77
+++ main.cpp	5 May 2005 12:03:40 -0000	1.78
@@ -250,6 +250,17 @@
 }
 
 static int runGame(GameDetector &detector, OSystem &system) {
+	// Create the game engine
+	Engine *engine = detector.createEngine(&system);
+	if (!engine) {
+		// TODO: Show an error dialog or so?
+		//GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!");
+		//alert.runModal();
+		warning("Failed to instantiate engine for target %s", detector._targetName.c_str());
+		return 0;
+	}
+
+
 	// Set the window caption to the game name
 	Common::String caption(ConfMan.get("description", detector._targetName));
 
@@ -261,10 +272,6 @@
 		system.setWindowCaption(caption.c_str());
 	}
 	
-	// Create the game engine
-	Engine *engine = detector.createEngine(&system);
-	assert(engine);
-
 	// Add extrapath (if any) to the directory search list
 	if (ConfMan.hasKey("extrapath"))
 		File::addDefaultDirectory(ConfMan.get("extrapath"));





More information about the Scummvm-git-logs mailing list