diff options
Diffstat (limited to 'src/vehicle_gui.h')
-rw-r--r-- | src/vehicle_gui.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h index d9e4ff173..e10ed2c18 100644 --- a/src/vehicle_gui.h +++ b/src/vehicle_gui.h @@ -99,6 +99,22 @@ static inline uint GetVehicleListHeight(VehicleType type) return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24; } +/** Get WindowClass for vehicle list of given vehicle type + * @param vt vehicle type to check + * @return corresponding window class + * @note works only for player buildable vehicle types + */ +static inline WindowClass GetWindowClassForVehicleType(VehicleType vt) +{ + switch (vt) { + default: NOT_REACHED(); + case VEH_TRAIN: return WC_TRAINS_LIST; + case VEH_ROAD: return WC_ROADVEH_LIST; + case VEH_SHIP: return WC_SHIPS_LIST; + case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST; + } +} + /* Unified window procedure */ void ShowVehicleViewWindow(const Vehicle *v); |