summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-30 14:38:45 +0000
committerfrosch <frosch@openttd.org>2013-06-30 14:38:45 +0000
commitf128c615951211457dd04bec4c3125f8259e2827 (patch)
treec91acd7b732f1f2bf7ea530b1b39050d580518cc /src
parentc640289d7f8aeb239e11cfb8c242edaf61606fd6 (diff)
downloadopenttd-f128c615951211457dd04bec4c3125f8259e2827.tar.xz
(svn r25542) -Fix: Do not just add 65 pixels to the width of the train vehicle list whenever it is opened, but remember the width of the train list separately from other vehicle types.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_gui.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index cfff95480..ff8719c07 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1456,8 +1456,6 @@ public:
this->FinishInitNested(window_number);
if (this->vli.company != OWNER_NONE) this->owner = this->vli.company;
-
- if (this->vli.vtype == VEH_TRAIN) ResizeWindow(this, 65, 0);
}
~VehicleListWindow()
@@ -1696,19 +1694,31 @@ public:
}
};
-static WindowDesc _vehicle_list_desc(
+static WindowDesc _vehicle_list_other_desc(
WDP_AUTO, "list_vehicles", 260, 246,
WC_INVALID, WC_NONE,
0,
_nested_vehicle_list, lengthof(_nested_vehicle_list)
);
+static WindowDesc _vehicle_list_train_desc(
+ WDP_AUTO, "list_vehicles_train", 325, 246,
+ WC_TRAINS_LIST, WC_NONE,
+ 0,
+ _nested_vehicle_list, lengthof(_nested_vehicle_list)
+);
+
static void ShowVehicleListWindowLocal(CompanyID company, VehicleListType vlt, VehicleType vehicle_type, uint16 unique_number)
{
if (!Company::IsValidID(company) && company != OWNER_NONE) return;
- _vehicle_list_desc.cls = GetWindowClassForVehicleType(vehicle_type);
- AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_desc, VehicleListIdentifier(vlt, vehicle_type, company, unique_number).Pack());
+ WindowNumber num = VehicleListIdentifier(vlt, vehicle_type, company, unique_number).Pack();
+ if (vehicle_type == VEH_TRAIN) {
+ AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_train_desc, num);
+ } else {
+ _vehicle_list_other_desc.cls = GetWindowClassForVehicleType(vehicle_type);
+ AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_other_desc, num);
+ }
}
void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type)