[Scummvm-cvs-logs] SF.net SVN: scummvm: [22356] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu May 4 17:27:00 CEST 2006


Revision: 22356
Author:   fingolfin
Date:     2006-05-04 17:26:03 -0700 (Thu, 04 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22356&view=rev

Log Message:
-----------
Removed Base::setTarget, and some minor cleanup & tweaks

Modified Paths:
--------------
    scummvm/trunk/backends/dc/dcmain.cpp
    scummvm/trunk/base/game.h
    scummvm/trunk/base/main.cpp
    scummvm/trunk/base/options.cpp
    scummvm/trunk/gui/launcher.cpp
Modified: scummvm/trunk/backends/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/dc/dcmain.cpp	2006-05-05 00:22:16 UTC (rev 22355)
+++ scummvm/trunk/backends/dc/dcmain.cpp	2006-05-05 00:26:03 UTC (rev 22356)
@@ -24,7 +24,6 @@
 #include <common/stdafx.h>
 #include <common/scummsys.h>
 #include <base/engine.h>
-#include <base/game.h>
 #include <base/main.h>
 #include <base/plugins.h>
 #include "dc.h"
@@ -224,7 +223,7 @@
     ConfMan.set("path", dir, base);
 
   // Set the target.
-  Base::setTarget(base);
+  ConfMan.setActiveDomain(base);
 
   return 0;
 }

Modified: scummvm/trunk/base/game.h
===================================================================
--- scummvm/trunk/base/game.h	2006-05-05 00:22:16 UTC (rev 22355)
+++ scummvm/trunk/base/game.h	2006-05-05 00:26:03 UTC (rev 22356)
@@ -61,9 +61,6 @@
 // TODO: Find a better place for this function.
 GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL);
 
-// TODO: Find a better place for this function.
-void setTarget(const Common::String &name);
-
 } // End of namespace Base
 
 

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-05-05 00:22:16 UTC (rev 22355)
+++ scummvm/trunk/base/main.cpp	2006-05-05 00:26:03 UTC (rev 22356)
@@ -84,18 +84,6 @@
 	return result;
 }
 
-// TODO: Find a better place for this function.
-void setTarget(const Common::String &target) {
-	ConfMan.setActiveDomain(target);
-
-	// Make sure the gameid is set in the config manager, and that it is lowercase.
-	Common::String gameid(target);
-	if (ConfMan.hasKey("gameid"))
-		gameid = ConfMan.get("gameid");
-	gameid.toLowercase();
-	ConfMan.set("gameid", gameid);
-}
-
 } // End of namespace Base
 
 
@@ -157,15 +145,19 @@
 
 static const Plugin *detectMain() {
 	const Plugin *plugin = 0;
-	
-	if (ConfMan.getActiveDomainName().empty()) {
-		warning("No game was specified...");
-		return 0;
-	}
 
-	printf("Looking for %s\n", ConfMan.get("gameid").c_str());
-	GameDescriptor game = Base::findGame(ConfMan.get("gameid"), &plugin);
+	// Make sure the gameid is set in the config manager, and that it is lowercase.
+	Common::String gameid(ConfMan.getActiveDomainName());
+	assert(!gameid.empty());
+	if (ConfMan.hasKey("gameid"))
+		gameid = ConfMan.get("gameid");
+	gameid.toLowercase();
+	ConfMan.set("gameid", gameid);
 
+	// Query the plugins and find one that will handle the specified gameid
+	printf("Looking for %s\n", gameid.c_str());
+	GameDescriptor game = Base::findGame(gameid, &plugin);
+
 	if (plugin == 0) {
 		printf("Failed game detection\n");
 		warning("%s is an invalid target. Use the --list-targets option to list targets", ConfMan.getActiveDomainName().c_str());
@@ -177,7 +169,6 @@
 	Common::String gameDataPath(ConfMan.get("path"));
 	if (gameDataPath.empty()) {
 		warning("No path was provided. Assuming the data files are in the current directory");
-		gameDataPath = "./";
 	} else if (gameDataPath.lastChar() != '/'
 #if defined(__MORPHOS__) || defined(__amigaos4__)
 					&& gameDataPath.lastChar() != ':'
@@ -275,7 +266,6 @@
 extern "C" int scummvm_main(int argc, char *argv[]) {
 	Common::String specialDebug;
 	Common::String command;
-	bool running = true;
 
 	// Verify that the backend has been initialized (i.e. g_system has been set).
 	assert(g_system);
@@ -348,8 +338,8 @@
 	setupDummyPalette(system);
 
 	// Unless a game was specified, show the launcher dialog
-	if (ConfMan.getActiveDomainName().empty()) {
-		running = launcherDialog(system);
+	if (0 == ConfMan.getActiveDomain()) {
+		launcherDialog(system);
 
 		// Discard any command line options. Those that affect the graphics
 		// mode etc. already have should have been handled by the backend at
@@ -361,7 +351,7 @@
 	// FIXME: We're now looping the launcher. This, of course, doesn't
 	// work as well as it should. In theory everything should be destroyed
 	// cleanly, so this is now enabled to encourage people to fix bits :)
-	while (running) {
+	while (0 != ConfMan.getActiveDomain()) {
 		// Verify the given game name is a valid supported game
 		const Plugin *plugin = detectMain();
 		if (plugin) {
@@ -377,13 +367,14 @@
 			// wanted to apply them to *all* games ever launched.
 			ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear();
 			
-			// TODO: Unset the active config domain
+			// Clear the active config domain
+			ConfMan.setActiveDomain("");
 
 			// PluginManager::instance().unloadPlugins();
 			PluginManager::instance().loadPlugins();
 		}
 
-		running = launcherDialog(system);
+		launcherDialog(system);
 	}
 
 	// Deinit the timer

Modified: scummvm/trunk/base/options.cpp
===================================================================
--- scummvm/trunk/base/options.cpp	2006-05-05 00:22:16 UTC (rev 22355)
+++ scummvm/trunk/base/options.cpp	2006-05-05 00:26:03 UTC (rev 22356)
@@ -665,7 +665,7 @@
 	// whether there is a gameid matching that name.
 	if (!command.empty()) {
 		if (ConfMan.hasGameDomain(command) || Base::findGame(command).gameid.size() > 0) {
-			Base::setTarget(command);
+			ConfMan.setActiveDomain(command);
 		} else {
 			usage("Unrecognized game target '%s'", command.c_str());
 		}

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-05-05 00:22:16 UTC (rev 22355)
+++ scummvm/trunk/gui/launcher.cpp	2006-05-05 00:26:03 UTC (rev 22356)
@@ -737,7 +737,7 @@
 	case kListItemDoubleClickedCmd:
 		// Print out what was selected
 		assert(item >= 0);
-		Base::setTarget(_domains[item]);
+		ConfMan.setActiveDomain(_domains[item]);
 		close();
 		break;
 	case kListSelectionChangedCmd:


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