1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-04 11:02:34 +01:00

Codechange: Replaced SmallVector::[Begin|End]() with std alternatives

This commit is contained in:
Henry Wilson
2019-02-17 11:20:52 +00:00
committed by PeterN
parent 297fd3dda3
commit ab711e6942
75 changed files with 464 additions and 555 deletions

View File

@@ -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 ⟨
}
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.