[Scummvm-cvs-logs] SF.net SVN: scummvm:[34909] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Nov 6 14:59:40 CET 2008


Revision: 34909
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34909&view=rev
Author:   fingolfin
Date:     2008-11-06 13:59:39 +0000 (Thu, 06 Nov 2008)

Log Message:
-----------
Simplified AdvancedMetaEngine::fallbackDetect usage

Modified Paths:
--------------
    scummvm/trunk/common/advancedDetector.cpp
    scummvm/trunk/common/advancedDetector.h
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/made/detection.cpp

Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp	2008-11-06 13:58:21 UTC (rev 34908)
+++ scummvm/trunk/common/advancedDetector.cpp	2008-11-06 13:59:39 UTC (rev 34909)
@@ -205,7 +205,7 @@
 
 	// Use fallback detector if there were no matches by other means
 	if (matches.empty()) {
-		const Common::ADGameDescription *fallbackDesc = fallbackDetect(&fslist);
+		const Common::ADGameDescription *fallbackDesc = fallbackDetect(fslist);
 		if (fallbackDesc != 0) {
 			GameDescriptor desc(toGameDescriptor(*fallbackDesc, params.list));
 			updateGameDescriptor(desc, fallbackDesc, params);
@@ -268,7 +268,7 @@
 
 	if (agdDesc == 0) {
 		// Use fallback detector if there were no matches by other means
-		agdDesc = fallbackDetect(NULL);
+		agdDesc = fallbackDetect(files);
 		if (agdDesc != 0) {
 			// Seems we found a fallback match. But first perform a basic
 			// sanity check: the gameid must match.

Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h	2008-11-06 13:58:21 UTC (rev 34908)
+++ scummvm/trunk/common/advancedDetector.h	2008-11-06 13:59:39 UTC (rev 34909)
@@ -210,11 +210,8 @@
 	 * An (optional) generic fallback detect function which is invoked
 	 * if both the regular MD5 based detection as well as the file
 	 * based fallback failed to detect anything.
-	 *
-	 * @note The fslist parameter may be 0 -- in that case, it is assumed
-	 *       that the callback searchs the current directory.
 	 */
-	virtual const Common::ADGameDescription *fallbackDetect(const FSList *fslist) const {
+	virtual const Common::ADGameDescription *fallbackDetect(const FSList &fslist) const {
 		return 0;
 	}
 };

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2008-11-06 13:58:21 UTC (rev 34908)
+++ scummvm/trunk/engines/agi/detection.cpp	2008-11-06 13:59:39 UTC (rev 34909)
@@ -2127,7 +2127,7 @@
 	virtual SaveStateList listSaves(const char *target) const;
 	virtual void removeSaveState(const char *target, int slot) const;
 	
-	const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const;
+	const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const;
 };
 
 bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -2203,7 +2203,7 @@
 	g_system->getSavefileManager()->removeSavefile(filename.c_str());
 }
 
-const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList *fslist) const {
+const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList &fslist) const {
 	typedef Common::HashMap<Common::String, int32> IntMap;
 	IntMap allFiles;
 	bool matchedUsingFilenames = false;
@@ -2212,24 +2212,11 @@
 	WagFileParser wagFileParser;
 	Common::FSNode wagFileNode;
 	Common::String description;
-	Common::FSList fslistCurrentDir; // Only used if fslist == NULL
 
 	// // Set the defaults for gameid and extra
 	_gameid = "agi-fanmade";
 	_extra.clear();
 
-	// Use the current directory for searching if fslist == NULL
-	if (fslist == NULL) {
-		Common::String path = ConfMan.get("path");
-
-		if (path.empty())
-			path = ".";
-
-		Common::FSNode fsCurrentDir(path);
-		fsCurrentDir.getChildren(fslistCurrentDir, Common::FSNode::kListFilesOnly);
-		fslist = &fslistCurrentDir;
-	}
-
 	// Set the default values for the fallback descriptor's ADGameDescription part.
 	g_fallbackDesc.desc.language = Common::UNK_LANG;
 	g_fallbackDesc.desc.platform = Common::kPlatformPC;
@@ -2241,7 +2228,7 @@
 	g_fallbackDesc.version = 0x2917;
 
 	// First grab all filenames and at the same time count the number of *.wag files
-	for (Common::FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) {
+	for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (file->isDirectory()) continue;
 		Common::String filename = file->getName();
 		filename.toLowercase();

Modified: scummvm/trunk/engines/made/detection.cpp
===================================================================
--- scummvm/trunk/engines/made/detection.cpp	2008-11-06 13:58:21 UTC (rev 34908)
+++ scummvm/trunk/engines/made/detection.cpp	2008-11-06 13:59:39 UTC (rev 34909)
@@ -350,7 +350,7 @@
 
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 
-	const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const;
+	const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const;
 
 };
 
@@ -362,7 +362,7 @@
 	return gd != 0;
 }
 
-const Common::ADGameDescription *MadeMetaEngine::fallbackDetect(const Common::FSList *fslist) const {
+const Common::ADGameDescription *MadeMetaEngine::fallbackDetect(const Common::FSList &fslist) const {
 	// Set the default values for the fallback descriptor's ADGameDescription part.
 	Made::g_fallbackDesc.desc.language = Common::UNK_LANG;
 	Made::g_fallbackDesc.desc.platform = Common::kPlatformPC;


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