summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-13 19:10:30 +0000
committerrubidium <rubidium@openttd.org>2010-11-13 19:10:30 +0000
commit034eb834cc277048e296bf1297f56e1667ab9881 (patch)
tree3f770bae27c7f9eada4fd763fb6d5405f58ad780 /src/strings.cpp
parent46cdc7b3d3f6d0eb9eb246f983c9e4121a84b025 (diff)
downloadopenttd-034eb834cc277048e296bf1297f56e1667ab9881.tar.xz
(svn r21177) -Codechange: change UniqueLanguageFile into GetLanguage
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index a51fb84d4..8cb362a1f 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1443,17 +1443,17 @@ int CDECL StringIDSorter(const StringID *a, const StringID *b)
}
/**
- * 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 *path)
/* 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;