summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-08-30 10:52:27 +0000
committeryexo <yexo@openttd.org>2010-08-30 10:52:27 +0000
commitcf2032d0f87aaa6b6caa5ef41631a0f1b7b8a324 (patch)
tree27b34db81d724669bc81e35499afc9294d5baf5f
parente91e2498c7ec37ffbbe948cd29bb15eedec85957 (diff)
downloadopenttd-cf2032d0f87aaa6b6caa5ef41631a0f1b7b8a324.tar.xz
(svn r20694) -Fix [FS#4087]: empty newgrf presets were not selectable
-rw-r--r--src/newgrf_gui.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index c659ac8fd..42e5f9bdd 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -896,19 +896,16 @@ struct NewGRFWindow : public QueryStringBaseWindow {
virtual void OnDropdownSelect(int widget, int index)
{
if (!this->editable) return;
- if (index == -1) {
- ClearGRFConfigList(&this->actives);
- this->preset = -1;
- } else {
+
+ ClearGRFConfigList(&this->actives);
+ this->preset = index;
+
+ if (index != -1) {
GRFConfig *c = LoadGRFPresetFromConfig(_grf_preset_list[index]);
- if (c != NULL) {
- this->active_sel = NULL;
- ClearGRFConfigList(&this->actives);
- this->actives = c;
- this->preset = index;
- this->avails.ForceRebuild();
- }
+ this->active_sel = NULL;
+ this->actives = c;
+ this->avails.ForceRebuild();
}
DeleteWindowByClass(WC_GRF_PARAMETERS);