[Scummvm-cvs-logs] SF.net SVN: scummvm:[33457] scummvm/trunk/common/advancedDetector.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Jul 30 17:48:17 CEST 2008
Revision: 33457
http://scummvm.svn.sourceforge.net/scummvm/?rev=33457&view=rev
Author: fingolfin
Date: 2008-07-30 15:48:16 +0000 (Wed, 30 Jul 2008)
Log Message:
-----------
Simplify/optimize/cleanup detectGameFilebased further
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2008-07-30 15:44:34 UTC (rev 33456)
+++ scummvm/trunk/common/advancedDetector.cpp 2008-07-30 15:48:16 UTC (rev 33457)
@@ -456,13 +456,16 @@
return matched;
}
+/**
+ * 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.
+ */
static ADGameDescList detectGameFilebased(const StringMap &allFiles, const Common::ADParams ¶ms) {
const ADFileBasedFallback *ptr;
const char* const* filenames;
- // Then we perform the actual filename matching. If there are
- // several matches, only the one with the maximum numbers of
- // files is considered.
int maxNumMatchedFiles = 0;
const ADGameDescription *matchedDesc = 0;
@@ -472,26 +475,24 @@
bool fileMissing = false;
for (filenames = ptr->filenames; *filenames; ++filenames) {
- if (fileMissing)
- continue;
-
debug(3, "++ %s", *filenames);
if (!allFiles.contains(*filenames)) {
fileMissing = true;
- continue;
+ break;
}
numMatchedFiles++;
}
- if (!fileMissing)
+ if (!fileMissing) {
debug(4, "Matched: %s", agdesc->gameid);
-
- if (!fileMissing && numMatchedFiles > maxNumMatchedFiles) {
- matchedDesc = agdesc;
- maxNumMatchedFiles = numMatchedFiles;
-
- debug(4, "and overriden");
+
+ if (numMatchedFiles > maxNumMatchedFiles) {
+ matchedDesc = agdesc;
+ maxNumMatchedFiles = numMatchedFiles;
+
+ debug(4, "and overriden");
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list