summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-07-17 20:18:18 +0000
committerfrosch <frosch@openttd.org>2012-07-17 20:18:18 +0000
commitcd867eb5737672d611b6c5570b87e6e6ef82cb66 (patch)
treed2ada6339276a2288a24560e7764efb260c70550
parent8361625ad61162c8e4ae5c6a871778d817d53381 (diff)
downloadopenttd-cd867eb5737672d611b6c5570b87e6e6ef82cb66.tar.xz
(svn r24411) -Add [FS#5244-ish]: Display the a setting type in the adv. settings description which explains the scope of changes to a particular setting.
-rw-r--r--src/lang/english.txt6
-rw-r--r--src/settings_gui.cpp28
2 files changed, 30 insertions, 4 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 0c3d8de5e..b78aebd55 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1105,6 +1105,12 @@ STR_WARNING_DIFFICULTY_TO_CUSTOM :{WHITE}This act
STR_CONFIG_SETTING_CAPTION :{WHITE}Advanced Settings
STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT :(no explanation available)
STR_CONFIG_SETTING_DEFAULT_VALUE :{LTBLUE}Default value: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_TYPE :{LTBLUE}Setting type: {ORANGE}{STRING}
+STR_CONFIG_SETTING_TYPE_CLIENT :Client setting (not stored in saves; affects all games)
+STR_CONFIG_SETTING_TYPE_GAME_MENU :Game setting (stored in saves; affects only new games)
+STR_CONFIG_SETTING_TYPE_GAME_INGAME :Game setting (stored in save; affects only current game)
+STR_CONFIG_SETTING_TYPE_COMPANY_MENU :Company setting (stored in saves; affects only new games)
+STR_CONFIG_SETTING_TYPE_COMPANY_INGAME :Company setting (stored in save; affects only current company)
STR_CONFIG_SETTING_OFF :Off
STR_CONFIG_SETTING_ON :On
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 6e87c483e..8c30135bb 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1744,10 +1744,20 @@ struct GameSettingsWindow : Window {
size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET;
break;
- case WID_GS_HELP_TEXT:
- size->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL +
+ case WID_GS_HELP_TEXT: {
+ static const StringID setting_types[] = {
+ STR_CONFIG_SETTING_TYPE_CLIENT,
+ STR_CONFIG_SETTING_TYPE_COMPANY_MENU, STR_CONFIG_SETTING_TYPE_COMPANY_INGAME,
+ STR_CONFIG_SETTING_TYPE_GAME_MENU, STR_CONFIG_SETTING_TYPE_GAME_INGAME,
+ };
+ for (uint i = 0; i < lengthof(setting_types); i++) {
+ SetDParam(0, setting_types[i]);
+ size->width = max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width);
+ }
+ size->height = 2 * FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL +
max(size->height, _settings_main_page.GetMaxHelpHeight(size->width));
break;
+ }
default:
break;
@@ -1776,10 +1786,20 @@ struct GameSettingsWindow : Window {
case WID_GS_HELP_TEXT:
if (this->last_clicked != NULL) {
const SettingDesc *sd = this->last_clicked->d.entry.setting;
- int32 default_value = ReadValue(&sd->desc.def, sd->save.conv);
- this->last_clicked->SetValueDParams(0, default_value);
int y = r.top;
+ if (sd->desc.flags & SGF_PER_COMPANY) {
+ SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
+ } else if (sd->save.conv & SLF_NOT_IN_SAVE) {
+ SetDParam(0, STR_CONFIG_SETTING_TYPE_CLIENT);
+ } else {
+ SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
+ }
+ DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
+ y += FONT_HEIGHT_NORMAL;
+
+ int32 default_value = ReadValue(&sd->desc.def, sd->save.conv);
+ this->last_clicked->SetValueDParams(0, default_value);
DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;