diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/strings.cpp | 7 | ||||
-rw-r--r-- | src/table/settings.h | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 2d9da5211..06565064d 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -40,10 +40,11 @@ #include "table/strings.h" #include "table/control_codes.h" +char _config_language_file[MAX_PATH]; ///< The file (name) stored in the configuration. const LanguageMetadata *_current_language = NULL; ///< The currently loaded language. DynamicLanguages _dynlang; ///< Language information of the program. -TextDirection _current_text_dir; ///< Text direction of the currently selected language +TextDirection _current_text_dir; ///< Text direction of the currently selected language. uint64 _decode_parameters[20]; ///< Global array of string parameters. To access, use #SetDParam. static char *StationGetSpecialString(char *buff, int x, const char *last); @@ -1387,7 +1388,7 @@ bool ReadLanguagePack(int lang_index) _current_language = &_dynlang.ent[lang_index]; _current_text_dir = (TextDirection)_current_language->text_dir; const char *c_file = strrchr(_current_language->file, PATHSEPCHAR) + 1; - strecpy(_dynlang.curr_file, c_file, lastof(_dynlang.curr_file)); + strecpy(_config_language_file, c_file, lastof(_config_language_file)); SetCurrentGrfLangID(_current_language->newgrflangid); InitializeSortedCargoSpecs(); @@ -1548,7 +1549,7 @@ void InitializeLanguagePacks() * configuration file, local environment and last, if nothing found, * english. If def equals -1, we have not picked a default language */ const char *lang_file = strrchr(_dynlang.ent[i].file, PATHSEPCHAR) + 1; - if (strcmp(lang_file, _dynlang.curr_file) == 0) chosen_language = i; + if (strcmp(lang_file, _config_language_file) == 0) chosen_language = i; if (chosen_language == -1) { if (strcmp (_dynlang.ent[i].isocode, "en_GB") == 0) en_GB_fallback = i; diff --git a/src/table/settings.h b/src/table/settings.h index 61653e746..f6defe331 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -249,6 +249,8 @@ static const SettingDescGlobVarList _win32_settings[] = { }; #endif /* WIN32 */ +extern char _config_language_file[MAX_PATH]; + static const SettingDescGlobVarList _misc_settings[] = { SDTG_MMANY("display_opt", SLE_UINT8, S, 0, _display_opt, (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_SHOW_WAYPOINT_NAMES), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS", STR_NULL, NULL), SDTG_BOOL("news_ticker_sound", S, 0, _news_ticker_sound, true, STR_NULL, NULL), @@ -260,7 +262,7 @@ static const SettingDescGlobVarList _misc_settings[] = { SDTG_STR("musicdriver", SLE_STRQ, S, 0, _ini_musicdriver, NULL, STR_NULL, NULL), SDTG_STR("sounddriver", SLE_STRQ, S, 0, _ini_sounddriver, NULL, STR_NULL, NULL), SDTG_STR("blitter", SLE_STRQ, S, 0, _ini_blitter, NULL, STR_NULL, NULL), - SDTG_STR("language", SLE_STRB, S, 0, _dynlang.curr_file, NULL, STR_NULL, NULL), + SDTG_STR("language", SLE_STRB, S, 0, _config_language_file, NULL, STR_NULL, NULL), SDTG_CONDLIST("resolution", SLE_INT, 2, S, 0, _cur_resolution, "640,480", STR_NULL, NULL, 0, SL_MAX_VERSION), // workaround for implicit lengthof() in SDTG_LIST SDTG_STR("screenshot_format",SLE_STRB, S, 0, _screenshot_format_name,NULL, STR_NULL, NULL), SDTG_STR("savegame_format", SLE_STRB, S, 0, _savegame_format, NULL, STR_NULL, NULL), |