changeset 4722:b916957a9b2e draft

(svn r6634) -Fix(r6377): Do not change a widget state after a DrawWindowWidgets, as it is a bit useless -Fix(r6562): Use the correct widget index for enabling
author belugas <belugas@openttd.org>
date Wed, 04 Oct 2006 00:51:13 +0000
parents 3f6288bf5048
children 31c4f40ecdd8
files vehicle_gui.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1575,9 +1575,16 @@
 		default: NOT_REACHED();
 	}
 
-	DrawWindowWidgets(w);
+	if (owner == _local_player) {
+		bool list_isempty vl->l.list_length == 0;
 
-	if (owner == _local_player && vl->l.list_length == 0) DisableWindowWidget(w, 9);
+		SetWindowWidgetDisabledState(w, VLW_WIDGET_SEND_TO_DEPOT, list_isempty);
+		SetWindowWidgetDisabledState(w, VLW_WIDGET_AUTOREPLACE, list_isempty);
+		SetWindowWidgetDisabledState(w, VLW_WIDGET_STOP_ALL, list_isempty);
+		SetWindowWidgetDisabledState(w, VLW_WIDGET_START_ALL, list_isempty);
+	}
+
+	DrawWindowWidgets(w);
 
 	/* draw sorting criteria string */
 	DrawString(85, 15, _vehicle_sort_listing[vl->l.sort_type], 0x10);