diff options
author | Max Horn | 2011-06-14 17:32:13 +0200 |
---|---|---|
committer | Max Horn | 2011-06-14 18:52:10 +0200 |
commit | 64e523141fa619c1632dcb2b215cfd85c41ef5a1 (patch) | |
tree | 9a7cbc79a86ffe3aab4a7718b3a8cbfc62488db7 /engines | |
parent | 068620479202f93c3057bc24f33a8c6f3da5a68d (diff) | |
download | scummvm-rg350-64e523141fa619c1632dcb2b215cfd85c41ef5a1.tar.gz scummvm-rg350-64e523141fa619c1632dcb2b215cfd85c41ef5a1.tar.bz2 scummvm-rg350-64e523141fa619c1632dcb2b215cfd85c41ef5a1.zip |
DETECTOR: Change detectGameFilebased return value
Diffstat (limited to 'engines')
-rw-r--r-- | engines/advancedDetector.cpp | 14 | ||||
-rw-r--r-- | engines/advancedDetector.h | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index cd94ce48e4..9a05e8513d 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -461,14 +461,17 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSList &fslist, Comm } // Filename based fallback - if (_fileBasedFallback != 0) - matched = detectGameFilebased(allFiles); + if (_fileBasedFallback != 0) { + g = detectGameFilebased(allFiles); + if (g) + matched.push_back(g); + } } return matched; } -ADGameDescList AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) const { +const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) const { const ADFileBasedFallback *ptr; const char* const* filenames; @@ -502,10 +505,7 @@ ADGameDescList AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) } } - ADGameDescList matched; - if (matchedDesc) { // We got a match - matched.push_back(matchedDesc); if (_flags & kADFlagPrintWarningOnFileBasedFallback) { Common::String report = Common::String::format(_("Your game version has been detected using " "filename matching as a variant of %s."), matchedDesc->gameid); @@ -518,7 +518,7 @@ ADGameDescList AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) } } - return matched; + return matchedDesc; } GameList AdvancedMetaEngine::getSupportedGames() const { diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 00a3faf58f..976f17ce35 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -257,12 +257,16 @@ protected: ADGameDescList detectGame(const Common::FSList &fslist, Common::Language language, Common::Platform platform, const Common::String &extra) const; /** - * Check for each ADFileBasedFallback record whether all files listed - * in it are present. If multiple pass this test, we pick the one with - * the maximal number of matching files. In case of a tie, the entry - * coming first in the list is chosen. + * Iterates over all ADFileBasedFallback records inside _fileBasedFallback. + * This then returns the record (or rather, the ADGameDescription + * contained in it) for which all files described by it are present, and + * among those the one with the maximal number of matching files. + * In case of a tie, the entry coming first in the list is chosen. + * + * @param allFiles a map describing all present files + * @param fileBasedFallback a list of ADFileBasedFallback records, zero-terminated */ - ADGameDescList detectGameFilebased(const FileMap &allFiles) const; + const ADGameDescription *detectGameFilebased(const FileMap &allFiles) const; // TODO void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const; |