summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-17 11:20:52 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commitab711e6942757d775c08c31a6c32d488feba1dba (patch)
treed102dc6d0e6b9c33e7205b63e3360ebd720a3ebb /src/strings.cpp
parent297fd3dda3abe353ebe2fe77c67b011e24d403bc (diff)
downloadopenttd-ab711e6942757d775c08c31a6c32d488feba1dba.tar.xz
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index c3f306183..204c68c20 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1876,8 +1876,8 @@ int CDECL StringIDSorter(const StringID *a, const StringID *b)
*/
const LanguageMetadata *GetLanguage(byte newgrflangid)
{
- for (const LanguageMetadata *lang = _languages.Begin(); lang != _languages.End(); lang++) {
- if (newgrflangid == lang->newgrflangid) return lang;
+ for (const LanguageMetadata &lang : _languages) {
+ if (newgrflangid == lang.newgrflangid) return &lang;
}
return NULL;
@@ -1960,22 +1960,22 @@ void InitializeLanguagePacks()
const LanguageMetadata *chosen_language = NULL; ///< Matching the language in the configuration file or the current locale
const LanguageMetadata *language_fallback = NULL; ///< Using pt_PT for pt_BR locale when pt_BR is not available
- const LanguageMetadata *en_GB_fallback = _languages.Begin(); ///< Fallback when no locale-matching language has been found
+ const LanguageMetadata *en_GB_fallback = _languages.data(); ///< Fallback when no locale-matching language has been found
/* Find a proper language. */
- for (const LanguageMetadata *lng = _languages.Begin(); lng != _languages.End(); lng++) {
+ for (const LanguageMetadata &lng : _languages) {
/* We are trying to find a default language. The priority is by
* configuration file, local environment and last, if nothing found,
* English. */
- const char *lang_file = strrchr(lng->file, PATHSEPCHAR) + 1;
+ const char *lang_file = strrchr(lng.file, PATHSEPCHAR) + 1;
if (strcmp(lang_file, _config_language_file) == 0) {
- chosen_language = lng;
+ chosen_language = &lng;
break;
}
- if (strcmp (lng->isocode, "en_GB") == 0) en_GB_fallback = lng;
- if (strncmp(lng->isocode, lang, 5) == 0) chosen_language = lng;
- if (strncmp(lng->isocode, lang, 2) == 0) language_fallback = lng;
+ if (strcmp (lng.isocode, "en_GB") == 0) en_GB_fallback = &lng;
+ if (strncmp(lng.isocode, lang, 5) == 0) chosen_language = &lng;
+ if (strncmp(lng.isocode, lang, 2) == 0) language_fallback = &lng;
}
/* We haven't found the language in the config nor the one in the locale.