[Scummvm-cvs-logs] SF.net SVN: scummvm:[46035] scummvm/trunk/tools/create_kyradat/ create_kyradat.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Nov 21 04:48:53 CET 2009


Revision: 46035
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46035&view=rev
Author:   lordhoto
Date:     2009-11-21 03:48:53 +0000 (Sat, 21 Nov 2009)

Log Message:
-----------
Add proper error messages, in case some entries aren't found.

Modified Paths:
--------------
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-11-21 03:47:54 UTC (rev 46034)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-11-21 03:48:53 UTC (rev 46035)
@@ -1349,13 +1349,16 @@
 	results.clear();
 	searchMap.clear();
 
+	bool result = true;
+
 	for (const int *entry = needList; *entry != -1; ++entry) {
 		MatchList possibleMatches = filterPlatformMatches(g, temporaryExtractMap.equal_range(*entry));
 
-		// This means, no matching entries were found, this is in general not a good sign, we might
-		// think of nicer handling of this in the future. TODO: Error out?
-		if (possibleMatches.empty())
+		if (possibleMatches.empty()) {
+			fprintf(stderr, "ERROR: No entry found for id %d/%s\n", *entry, getIdString(*entry));
+			result = false;
 			continue;
+		}
 
 		const ExtractFilename *fDesc = getFilenameDesc(*entry);
 		if (!fDesc)
@@ -1367,27 +1370,30 @@
 					continue;
 
 				MatchList langMatches = filterLanguageMatches(g->lang[i], possibleMatches);
-				if (langMatches.empty())
-					printf("foo %s %d\n", getIdString(*entry), g->lang[i]);
 				MatchList::const_iterator bestMatch = filterOutBestMatch(langMatches);
 
-				// TODO: Error out. This case means an entry was not found for a required language.
-				if (bestMatch == langMatches.end())
+				if (bestMatch == langMatches.end()) {
+					// TODO: Add nice language name to output message.
+					fprintf(stderr, "ERROR: No entry found for id %d/%s for language %d\n", *entry, getIdString(*entry), g->lang[i]);
+					result = false;
 					continue;
+				}
 
 				map.insert(**bestMatch);
 			}
 		} else {
 			MatchList::const_iterator bestMatch = filterOutBestMatch(possibleMatches);
 
-			// TODO: Error out. This case means an entry was not found.
-			if (bestMatch == possibleMatches.end())
+			if (bestMatch == possibleMatches.end()) {
+				fprintf(stderr, "ERROR: No entry found for id %d/%s\n", *entry, getIdString(*entry));
+				result = false;
 				continue;
+			}
 
 			map.insert(**bestMatch);
 		}
 	}
 
-	return true;
+	return result;
 }
 


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