changeset 16006:25371ea61636 draft

(svn r20694) -Fix [FS#4087]: empty newgrf presets were not selectable
author yexo <yexo@openttd.org>
date Mon, 30 Aug 2010 10:52:27 +0000
parents 7764dbf80272
children 95d1cce7fb19
files src/newgrf_gui.cpp
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -896,19 +896,16 @@
 	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);