Changeset - r16451:22dc35cde747
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-11-13 19:10:30
rubidium@openttd.org
(svn r21177) -Codechange: change UniqueLanguageFile into GetLanguage
2 files changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/language.h
Show inline comments
 
@@ -103,5 +103,6 @@ extern LanguageList _languages;
 
extern const LanguageMetadata *_current_language;
 

	
 
bool ReadLanguagePack(const LanguageMetadata *lang);
 
const LanguageMetadata *GetLanguage(byte newgrflangid);
 

	
 
#endif /* LANGUAGE_H */
src/strings.cpp
Show inline comments
 
@@ -1443,17 +1443,17 @@ int CDECL StringIDSorter(const StringID 
 
}
 

	
 
/**
 
 * Checks whether the given language is already found.
 
 * @param newgrflangid NewGRF languages ID to check
 
 * @return true if and only if a language file with the same language ID has not been found
 
 * Get the language with the given NewGRF language ID.
 
 * @param newgrflangid NewGRF languages ID to check.
 
 * @return The language's metadata, or NULL if it is not known.
 
 */
 
static bool UniqueLanguageFile(byte newgrflangid)
 
const LanguageMetadata *GetLanguage(byte newgrflangid)
 
{
 
	for (const LanguageMetadata *lang = _languages.Begin(); lang != _languages.End(); lang++) {
 
		if (newgrflangid == lang->newgrflangid) return false;
 
		if (newgrflangid == lang->newgrflangid) return lang;
 
	}
 

	
 
	return true;
 
	return NULL;
 
}
 

	
 
/**
 
@@ -1499,7 +1499,7 @@ static void GetLanguageList(const char *
 
			/* Check whether the file is of the correct version */
 
			if (!GetLanguageFileHeader(lmd.file, &lmd)) {
 
				DEBUG(misc, 3, "%s is not a valid language file", lmd.file);
 
			} else if (!UniqueLanguageFile(lmd.newgrflangid)) {
 
			} else if (GetLanguage(lmd.newgrflangid) != NULL) {
 
				DEBUG(misc, 3, "%s's language ID is already known", lmd.file);
 
			} else {
 
				*_languages.Append() = lmd;
0 comments (0 inline, 0 general)