aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2006-02-18 12:50:48 +0000
committerMax Horn2006-02-18 12:50:48 +0000
commit01fc7034b535e2dcc0526d5ac4d1ae4eae60459f (patch)
tree4e10d3d934d77825bd9f76fc4eca0177067e596a /base
parent8ac17430ac7aa3bba5630d74a1eeda54bce7801b (diff)
downloadscummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.tar.gz
scummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.tar.bz2
scummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.zip
- Merged GameDetector::detectGame() into GameDetector::detectMain()
- Replaced GameSettings GameDetector::_game by a simple gameid string svn-id: r20753
Diffstat (limited to 'base')
-rw-r--r--base/gameDetector.cpp34
-rw-r--r--base/gameDetector.h9
-rw-r--r--base/main.cpp5
3 files changed, 19 insertions, 29 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index b2aa2d64f7..d787f257e1 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -225,7 +225,6 @@ GameDetector::GameDetector() {
_force1xOverlay = false;
#endif
- memset(&_game, 0, sizeof(_game));
_plugin = 0;
}
@@ -630,37 +629,28 @@ void GameDetector::setTarget(const String &target) {
ConfMan.setActiveDomain(target);
}
-bool GameDetector::detectGame() {
- String realGame;
-
- if (ConfMan.hasKey("gameid"))
- realGame = ConfMan.get("gameid");
- else
- realGame = _targetName;
-
- printf("Looking for %s\n", realGame.c_str());
- _game = findGame(realGame, &_plugin);
-
- if (_game.gameid) {
- printf("Trying to start game '%s'\n", _game.description);
- return true;
- } else {
- printf("Failed game detection\n");
- return false;
- }
-}
-
bool GameDetector::detectMain() {
if (_targetName.isEmpty()) {
warning("No game was specified...");
return false;
}
- if (!detectGame()) {
+ if (ConfMan.hasKey("gameid"))
+ _gameid = ConfMan.get("gameid");
+ else
+ _gameid = _targetName;
+
+ printf("Looking for %s\n", _gameid.c_str());
+ GameSettings game = findGame(_gameid, &_plugin);
+
+ if (!game.gameid) {
+ printf("Failed game detection\n");
warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str());
return false;
}
+ printf("Trying to start game '%s'\n", game.description);
+
String gameDataPath(ConfMan.get("path"));
if (gameDataPath.isEmpty()) {
warning("No path was provided. Assuming the data files are in the current directory");
diff --git a/base/gameDetector.h b/base/gameDetector.h
index bdbb68bf90..0cada3e597 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -65,14 +65,13 @@ public:
bool detectMain();
String _targetName;
- GameSettings _game; // TODO: Eventually get rid of this?!
- const Plugin *_plugin;
+ String _gameid;
bool _dumpScripts;
bool _force1xOverlay;
- void setTarget(const String &name);
+ const Plugin *_plugin; // TODO: This should be protected
public:
Engine *createEngine(OSystem *system);
@@ -81,8 +80,8 @@ public:
static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);
-protected:
- bool detectGame(void);
+//protected:
+ void setTarget(const String &name); // TODO: This should be protected
};
#endif
diff --git a/base/main.cpp b/base/main.cpp
index 4d74a77858..4328b4a81a 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -291,8 +291,9 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String
// Set the window caption to the game name
Common::String caption(ConfMan.get("description", detector._targetName));
- if (caption.isEmpty() && detector._game.description)
- caption = detector._game.description;
+ const char *desc = GameDetector::findGame(detector._gameid).description;
+ if (caption.isEmpty() && desc)
+ caption = desc;
if (caption.isEmpty())
caption = detector._targetName;
if (!caption.isEmpty()) {