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
This commit is contained in:
Torbjörn Andersson 2006-09-29 18:20:44 +00:00
parent 907141c909
commit 6a1f9eee64

View File

@ -1666,18 +1666,22 @@ bool AGOSEngine::initGame() {
if (ConfMan.hasKey("platform"))
platform = Common::parsePlatform(ConfMan.get("platform"));
Common::String gameid = ConfMan.get("gameid");
// 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...
count = detectGame(NULL, language, platform, matches);
if (count == 0) {
warning("No valid games were found in the specified directory.");
return false;
for (int i = 0; i < count; i++) {
if (toDetectedGame(gameDescriptions[matches[i]]).gameid == gameid) {
gameNumber = matches[i];
break;
}
}
if (count != 1)
warning("Conflicting targets detected (%d)", count);
gameNumber = matches[0];
free(matches);
if (gameNumber >= gameCount || gameNumber == -1) {