summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2009-04-13 17:19:43 +0000
committerglx <glx@openttd.org>2009-04-13 17:19:43 +0000
commit529bd1eddb7a168dd9b634e4fc52271f183ee12c (patch)
tree4e185150d1e91b8eb8458768aa7af0c76ad0792a /src/vehicle_gui.cpp
parent5d12d1b5105dbcd8d7de9d84997642a491283759 (diff)
downloadopenttd-529bd1eddb7a168dd9b634e4fc52271f183ee12c.tar.xz
(svn r16054) -Fix: non advanced vehicle list didn't handle company switching correctly
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index d7080cedf..eb140d6f9 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -883,21 +883,6 @@ struct VehicleListWindow : public BaseVehicleListWindow {
this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
this->owner = company;
- /* Hide the widgets that we will not use in this window
- * Some windows contains actions only fit for the owner */
- if (company == _local_company) {
- this->HideWidget(VLW_WIDGET_OTHER_COMPANY_FILLER);
- this->SetWidgetDisabledState(VLW_WIDGET_AVAILABLE_VEHICLES, window_type != VLW_STANDARD);
- } else {
- this->SetWidgetsHiddenState(true,
- VLW_WIDGET_AVAILABLE_VEHICLES,
- VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
- VLW_WIDGET_STOP_ALL,
- VLW_WIDGET_START_ALL,
- VLW_WIDGET_EMPTY_BOTTOM_RIGHT,
- WIDGET_LIST_END);
- }
-
/* Set up the window widgets */
switch (this->vehicle_type) {
case VEH_TRAIN:
@@ -1064,11 +1049,25 @@ struct VehicleListWindow : public BaseVehicleListWindow {
default: NOT_REACHED(); break;
}
- this->SetWidgetsDisabledState(this->vehicles.Length() == 0,
+ /* Hide the widgets that we will not use in this window
+ * Some windows contains actions only fit for the owner */
+ this->SetWidgetsHiddenState(this->owner != _local_company,
+ VLW_WIDGET_AVAILABLE_VEHICLES,
VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
VLW_WIDGET_STOP_ALL,
VLW_WIDGET_START_ALL,
+ VLW_WIDGET_EMPTY_BOTTOM_RIGHT,
WIDGET_LIST_END);
+ this->SetWidgetHiddenState(VLW_WIDGET_OTHER_COMPANY_FILLER, this->owner == _local_company);
+ if (this->owner == _local_company) {
+ this->SetWidgetDisabledState(VLW_WIDGET_AVAILABLE_VEHICLES, window_type != VLW_STANDARD);
+ this->SetWidgetsDisabledState(this->vehicles.Length() == 0,
+ VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
+ VLW_WIDGET_STOP_ALL,
+ VLW_WIDGET_START_ALL,
+ WIDGET_LIST_END);
+ }
+
/* Set text of sort by dropdown widget. */
this->widget[VLW_WIDGET_SORT_BY_PULLDOWN].data = this->vehicle_sorter_names[this->vehicles.SortType()];