train_gui.c
changeset 5191 8d16c129d934
parent 5190 9c6fcdf4963f
child 5195 760e977670e0
--- a/train_gui.c	Thu Nov 30 18:16:08 2006 +0000
+++ b/train_gui.c	Thu Nov 30 18:23:25 2006 +0000
@@ -447,7 +447,6 @@
 	uint16 scrollcount = 0;
 
 	SetWindowWidgetDisabledState(w, BUILD_TRAIN_WIDGET_BUILD, w->window_number == 0); // Disable unless we got a depot to build in
-	GenerateBuildList(w);
 
 	/* Make sure that the selected engine is still in the list*/
 	if (bv->sel_engine != INVALID_ENGINE) {
@@ -493,9 +492,11 @@
 			bv->sel_engine            = INVALID_ENGINE;
 			bv->sort_criteria         = _last_sort_criteria;
 			bv->descending_sort_order = _last_sort_order;
+			GenerateBuildList(w);
 			break;
 
 		case WE_INVALIDATE_DATA:
+			GenerateBuildList(w);
 			SetWindowDirty(w);
 			break;
 
@@ -511,6 +512,7 @@
 			switch (e->we.click.widget) {
 				case BUILD_TRAIN_WIDGET_SORT_ASCENDING_DESCENDING:
 					_last_sort_order = bv->descending_sort_order = !bv->descending_sort_order;
+					GenerateBuildList(w);
 					SetWindowDirty(w);
 					break;
 
@@ -557,8 +559,9 @@
 			if (bv->sort_criteria != e->we.dropdown.index) {
 				bv->sort_criteria = e->we.dropdown.index;
 				_last_sort_criteria = e->we.dropdown.index;
+				GenerateBuildList(w);
+				SetWindowDirty(w);
 			}
-			SetWindowDirty(w);
 			break;
 
 		case WE_RESIZE: {