summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-26 17:43:06 +0000
committerrubidium <rubidium@openttd.org>2009-09-26 17:43:06 +0000
commitac99610a05dce9510a3074658edcb745e0430504 (patch)
tree40dfa784f10b08e4f89a438f7744807d6ac801e2 /src/settings_gui.cpp
parenta47138ad34f6b74ee83e0bdb3c5c9d317465ecb3 (diff)
downloadopenttd-ac99610a05dce9510a3074658edcb745e0430504.tar.xz
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index a68757f42..6886d8cbc 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -547,7 +547,7 @@ public:
this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
/* Setup disabled buttons when creating window
* disable all other difficulty buttons during gameplay except for 'custom' */
- this->SetWidgetsDisabledState(_game_mode == GM_NORMAL,
+ this->SetWidgetsDisabledState(_game_mode != GM_MENU,
GDW_LVL_EASY,
GDW_LVL_MEDIUM,
GDW_LVL_HARD,
@@ -610,10 +610,6 @@ public:
const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + (widget / 3);
const SettingDescBase *sdb = &sd->desc;
- /* Clicked disabled button? */
- bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0);
- if (!editable) return;
-
int32 val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv);
if (widget % 3 == 1) {
/* Increase button clicked */
@@ -690,10 +686,12 @@ public:
/* skip deprecated difficulty options */
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv);
- bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0);
+ bool disable = (sd->desc.flags & SGF_NEWGAME_ONLY) &&
+ (_game_mode == GM_NORMAL ||
+ (_game_mode == GM_EDITOR && (sd->desc.flags & SGF_SCENEDIT_TOO) == 0));
- this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 0, !editable || sdb->min == value);
- this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 1, !editable || sdb->max == (uint32)value);
+ this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 0, disable || sdb->min == value);
+ this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 1, disable || sdb->max == (uint32)value);
}
}
};