(svn r20694) -Fix [FS#4087]: empty newgrf presets were not selectable

This commit is contained in:
yexo
2010-08-30 10:52:27 +00:00
parent 79dceff5ac
commit fbbc105156

View File

@@ -896,20 +896,17 @@ struct NewGRFWindow : public QueryStringBaseWindow {
virtual void OnDropdownSelect(int widget, int index) virtual void OnDropdownSelect(int widget, int index)
{ {
if (!this->editable) return; if (!this->editable) return;
if (index == -1) {
ClearGRFConfigList(&this->actives); ClearGRFConfigList(&this->actives);
this->preset = -1; this->preset = index;
} else {
if (index != -1) {
GRFConfig *c = LoadGRFPresetFromConfig(_grf_preset_list[index]); GRFConfig *c = LoadGRFPresetFromConfig(_grf_preset_list[index]);
if (c != NULL) {
this->active_sel = NULL; this->active_sel = NULL;
ClearGRFConfigList(&this->actives);
this->actives = c; this->actives = c;
this->preset = index;
this->avails.ForceRebuild(); this->avails.ForceRebuild();
} }
}
DeleteWindowByClass(WC_GRF_PARAMETERS); DeleteWindowByClass(WC_GRF_PARAMETERS);
this->active_sel = NULL; this->active_sel = NULL;