aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-09-29 18:20:44 +0000
committerTorbjörn Andersson2006-09-29 18:20:44 +0000
commit6a1f9eee64f476fb801ce5cb5d5d3a656b454495 (patch)
tree160b6af3a96b405ffb7682e49ed1b48380288b36 /engines/agos
parent907141c909fa69c9357cd3b115f52459e999c2a7 (diff)
downloadscummvm-rg350-6a1f9eee64f476fb801ce5cb5d5d3a656b454495.tar.gz
scummvm-rg350-6a1f9eee64f476fb801ce5cb5d5d3a656b454495.tar.bz2
scummvm-rg350-6a1f9eee64f476fb801ce5cb5d5d3a656b454495.zip
When starting a game, make sure that it has the desired target name. The old
behaviour was to simply pick the first detected game, which made it necessary to keep the Puzzle Pack data files in different directories. Now they can all be in the same one. (Generally it's not a good idea to keep several games in the same directory, of course, but in this case it's perfectly reasonable.) svn-id: r24020
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/game.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/engines/agos/game.cpp b/engines/agos/game.cpp
index 9c370e3988..4781831822 100644
--- a/engines/agos/game.cpp
+++ b/engines/agos/game.cpp
@@ -1666,17 +1666,21 @@ bool AGOSEngine::initGame() {
if (ConfMan.hasKey("platform"))
platform = Common::parsePlatform(ConfMan.get("platform"));
- count = detectGame(NULL, language, platform, matches);
+ Common::String gameid = ConfMan.get("gameid");
- if (count == 0) {
- warning("No valid games were found in the specified directory.");
- return false;
- }
+ // At this point, Engine_AGOS_create() has already verified that the
+ // desired game is in the specified directory. But we've already
+ // forgotten which particular version it was, so we have to do it all
+ // over again...
- if (count != 1)
- warning("Conflicting targets detected (%d)", count);
+ count = detectGame(NULL, language, platform, matches);
- gameNumber = matches[0];
+ for (int i = 0; i < count; i++) {
+ if (toDetectedGame(gameDescriptions[matches[i]]).gameid == gameid) {
+ gameNumber = matches[i];
+ break;
+ }
+ }
free(matches);