aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);