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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Dec 20 01:08:53 CET 2006


Revision: 24899
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24899&view=rev
Author:   fingolfin
Date:     2006-12-19 16:08:51 -0800 (Tue, 19 Dec 2006)

Log Message:
-----------
Stripped some more real_ prefixes from function names; also added a new FIXME comment to Kyra's setupGameFlags, and did some more cleanup

Modified Paths:
--------------
    scummvm/trunk/common/advancedDetector.cpp
    scummvm/trunk/common/advancedDetector.h
    scummvm/trunk/engines/kyra/plugin.cpp

Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp	2006-12-19 23:59:26 UTC (rev 24898)
+++ scummvm/trunk/common/advancedDetector.cpp	2006-12-20 00:08:51 UTC (rev 24899)
@@ -33,7 +33,7 @@
 
 namespace Common {
 
-PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
+PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
 	DetectedGameList (*detectFunc)(const FSList &fslist),
 	const Common::ADObsoleteGameID *obsoleteList
 	) {
@@ -72,7 +72,7 @@
 	return kNoGameDataFoundError;
 }
 
-GameDescriptor real_ADVANCED_DETECTOR_FIND_GAMEID(
+GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
 	const char *gameid,
 	const PlainGameDescriptor *list,
 	const Common::ADObsoleteGameID *obsoleteList
@@ -174,7 +174,7 @@
 	matches = ad.detectGame(0, md5Bytes, language, platform);
 
 	for (uint i = 0; i < matches.size(); i++) {
-		if (toDetectedGame(*(const ADGameDescription *)(descs + matches[i] * descItemSize), list).gameid == gameid) {
+		if (((const ADGameDescription *)(descs + matches[i] * descItemSize))->gameid == gameid) {
 			gameNumber = matches[i];
 			break;
 		}

Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h	2006-12-19 23:59:26 UTC (rev 24898)
+++ scummvm/trunk/common/advancedDetector.h	2006-12-20 00:08:51 UTC (rev 24899)
@@ -92,7 +92,7 @@
 
 // FIXME/TODO: Rename this function to something more sensible.
 // Possibly move it inside class AdvancedDetector ?
-GameDescriptor real_ADVANCED_DETECTOR_FIND_GAMEID(
+GameDescriptor ADVANCED_DETECTOR_FIND_GAMEID(
 	const char *gameid,
 	const PlainGameDescriptor *list,
 	const Common::ADObsoleteGameID *obsoleteList
@@ -121,7 +121,7 @@
 
 // FIXME/TODO: Rename this function to something more sensible.
 // Possibly move it inside class AdvancedDetector ?
-PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
+PluginError ADVANCED_DETECTOR_ENGINE_CREATE(
 	DetectedGameList (*detectFunc)(const FSList &fslist),
 	const Common::ADObsoleteGameID *obsoleteList
 	);
@@ -132,7 +132,7 @@
 		return GameList(list); \
 	} \
 	GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
-		return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
+		return Common::ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
 	} \
 	DetectedGameList Engine_##engine##_detectGames(const FSList &fslist) { \
 		return detectFunc(fslist);						\
@@ -140,7 +140,7 @@
 	PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
 		assert(syst); \
 		assert(engine); \
-		PluginError err = real_ADVANCED_DETECTOR_ENGINE_CREATE(detectFunc, obsoleteList); \
+		PluginError err = ADVANCED_DETECTOR_ENGINE_CREATE(detectFunc, obsoleteList); \
 		if (err == kNoError) \
 			*engine = new createFunction(syst); \
 		return err; \

Modified: scummvm/trunk/engines/kyra/plugin.cpp
===================================================================
--- scummvm/trunk/engines/kyra/plugin.cpp	2006-12-19 23:59:26 UTC (rev 24898)
+++ scummvm/trunk/engines/kyra/plugin.cpp	2006-12-20 00:08:51 UTC (rev 24899)
@@ -150,21 +150,6 @@
 	{ { NULL, NULL, NULL, UNK_LANG, kPlatformUnknown }, KYRA2_UNK_FLAGS }
 };
 
-static ADList detectKyraGames(const FSList &fslist) {
-	Common::AdvancedDetector ad;
-	Common::ADList matches;
-	Common::ADGameDescList descList;
-
-	for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) {
-		descList.push_back(&adGameDescs[i].desc);
-	}
-
-	ad.registerGameDescriptions(descList);
-
-	matches = ad.detectGame(&fslist, kMD5FileSizeLimit, Common::UNK_LANG, Common::kPlatformUnknown);
-	return matches;
-}
-
 static bool setupGameFlags(const ADList &list, GameFlags &flags) {
 	if (!list.size()) {
 		// maybe add non md5 based detection again?
@@ -173,6 +158,8 @@
 
 	int id = list[0];
 
+	// FIXME: Isn't the following check/loop obsolete (i.e. I was/am under the
+	// impression that AdvancedDetector already performs this check).
 	if (list.size() > 1) {
 		int filesCount = 0;
 		int curID = 0;
@@ -222,7 +209,7 @@
 }
 
 GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
-	return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid, gameList, 0);
+	return Common::ADVANCED_DETECTOR_FIND_GAMEID(gameid, gameList, 0);
 }
 
 DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
@@ -246,8 +233,19 @@
 	}
 
 	GameFlags flags;
-	ADList games = detectKyraGames(fslist);
-	if (!setupGameFlags(games, flags)) {
+	Common::AdvancedDetector ad;
+	Common::ADList matches;
+	Common::ADGameDescList descList;
+
+	for (int i = 0; i < ARRAYSIZE(adGameDescs) - 1; ++i) {
+		descList.push_back(&adGameDescs[i].desc);
+	}
+
+	ad.registerGameDescriptions(descList);
+
+	matches = ad.detectGame(&fslist, kMD5FileSizeLimit, Common::UNK_LANG, Common::kPlatformUnknown);
+
+	if (!setupGameFlags(matches, flags)) {
 		return kNoGameDataFoundError;
 	}
 


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