summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-13 11:25:58 +0000
committerrubidium <rubidium@openttd.org>2010-11-13 11:25:58 +0000
commitf4e4056aed7f464f6b3de47ffbd1a1a93979fe84 (patch)
tree63b1b46cc37812740a3ea77f4a3f797dca75c5d1 /src/settings_gui.cpp
parentf1959206951a77891664c461cd51c4f4b90db753 (diff)
downloadopenttd-f4e4056aed7f464f6b3de47ffbd1a1a93979fe84.tar.xz
(svn r21161) -Codechange: make the currently used language easier accessible
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 14476b5dd..871a3b8ea 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -32,6 +32,7 @@
#include "viewport_func.h"
#include "core/geometry_func.hpp"
#include "ai/ai.hpp"
+#include "language.h"
#include <map>
#include "table/sprites.h"
@@ -190,7 +191,7 @@ struct GameOptionsWindow : Window {
case GOW_ROADSIDE_DROPDOWN: SetDParam(0, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT + this->opt->vehicle.road_side); break;
case GOW_TOWNNAME_DROPDOWN: SetDParam(0, TownName(this->opt->game_creation.town_name)); break;
case GOW_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break;
- case GOW_LANG_DROPDOWN: SetDParam(0, SPECSTR_LANGUAGE_START + _dynlang.curr); break;
+ case GOW_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break;
case GOW_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break;
case GOW_SCREENSHOT_DROPDOWN: SetDParam(0, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); break;
case GOW_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); break;
@@ -315,14 +316,18 @@ struct GameOptionsWindow : Window {
/* Sort language names */
LangList langs;
- for (int i = 0; i < _dynlang.num; i++) langs[SPECSTR_LANGUAGE_START + i] = i;
+ int current_lang;
+ for (int i = 0; i < _dynlang.num; i++) {
+ if (&_dynlang.ent[i] == _current_language) current_lang = i;
+ langs[SPECSTR_LANGUAGE_START + i] = i;
+ }
DropDownList *list = new DropDownList();
for (LangList::iterator it = langs.begin(); it != langs.end(); it++) {
list->push_back(new DropDownListStringItem((*it).first, (*it).second, false));
}
- ShowDropDownList(this, list, _dynlang.curr, GOW_LANG_DROPDOWN);
+ ShowDropDownList(this, list, current_lang, GOW_LANG_DROPDOWN);
break;
}