aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/advancedDetector.cpp14
-rw-r--r--engines/advancedDetector.h14
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;