# vehicle_gui.cpp File Reference

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "debug.h"`
`#include "player_func.h"`
`#include "station.h"`
`#include "engine.h"`
`#include "gui.h"`
`#include "window_gui.h"`
`#include "textbuf_gui.h"`
`#include "command_func.h"`
`#include "variables.h"`
`#include "vehicle_gui.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "train.h"`
`#include "newgrf_callbacks.h"`
`#include "newgrf_engine.h"`
`#include "newgrf_text.h"`
`#include "ship.h"`
`#include "aircraft.h"`
`#include "roadveh.h"`
`#include "depot.h"`
`#include "cargotype.h"`
`#include "group.h"`
`#include "group_gui.h"`
`#include "strings_func.h"`
`#include "functions.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "autoreplace_gui.h"`
`#include "core/alloc_func.hpp"`
`#include "string_func.h"`
`#include "settings_type.h"`
`#include "widgets/dropdown_func.h"`
`#include "table/sprites.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | Sorting
struct | RefitOption
struct | RefitList
## Defines
#define | VEHICLEUNITNUMBERSORTER(r, a, b) {if (r == 0) {r = a->unitnumber - b->unitnumber;}}
## Typedefs
typedef int CDECL | VehicleSortListingTypeFunction (const void *, const void *)
## Enumerations
enum | VehicleListWindowWidgets { VLW_WIDGET_CLOSEBOX = 0, VLW_WIDGET_CAPTION, VLW_WIDGET_STICKY, VLW_WIDGET_SORT_ORDER, VLW_WIDGET_SORT_BY_PULLDOWN, VLW_WIDGET_EMPTY_TOP_RIGHT, VLW_WIDGET_LIST, VLW_WIDGET_SCROLLBAR, VLW_WIDGET_OTHER_PLAYER_FILLER, VLW_WIDGET_AVAILABLE_VEHICLES, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, VLW_WIDGET_STOP_ALL, VLW_WIDGET_START_ALL, VLW_WIDGET_EMPTY_BOTTOM_RIGHT, VLW_WIDGET_RESIZE }
enum | VehicleDetailsWindowWidgets { VLD_WIDGET_CLOSEBOX = 0, VLD_WIDGET_CAPTION, VLD_WIDGET_RENAME_VEHICLE, VLD_WIDGET_TOP_DETAILS, VLD_WIDGET_INCREASE_SERVICING_INTERVAL, VLD_WIDGET_DECREASE_SERVICING_INTERVAL, VLD_WIDGET_BOTTOM_RIGHT, VLD_WIDGET_MIDDLE_DETAILS, VLD_WIDGET_SCROLLBAR, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TRAIN_VEHICLES, VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, VLD_WIDGET_DETAILS_TOTAL_CARGO, VLD_WIDGET_RESIZE }
| Constants of vehicle details widget indices.
enum | VehicleStringTranslation { VST_VEHICLE_AGE_RUNNING_COST_YR, VST_VEHICLE_MAX_SPEED, VST_VEHICLE_PROFIT_THIS_YEAR_LAST_YEAR, VST_VEHICLE_RELIABILITY_BREAKDOWNS }
| Command indices for the _vehicle_command_translation_table. More...
enum | VehicleCommandTranslation { VCT_CMD_START_STOP = 0, VCT_CMD_GOTO_DEPOT, VCT_CMD_CLONE_VEH, VCT_CMD_TURN_AROUND }
| Command indices for the _vehicle_command_translation_table. More...
## Functions
void | RebuildVehicleLists ()
void | ResortVehicleLists ()
void | BuildVehicleList (vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type)
void | SortVehicleList (vehiclelist_d *vl)
void | DepotSortList (Vehicle **v, uint16 length)
void | DrawVehicleProfitButton (const Vehicle *v, int x, int y)
| draw the vehicle profit button in the vehicle list window.
static RefitList * | BuildRefitList (const Vehicle *v)
static RefitOption * | DrawVehicleRefitWindow (const RefitList *list, int sel, uint pos, uint rows, uint delta)
| Draw the list of available refit options for a consist.
static void | VehicleRefitWndProc (Window *w, WindowEvent *e)
void | ShowVehicleRefitWindow (const Vehicle *v, VehicleOrderID order)
| Show the refit window for a vehicle.
uint | ShowAdditionalText (int x, int y, uint w, EngineID engine)
| Display additional text from NewGRF in the purchase information window.
uint | ShowRefitOptionsList (int x, int y, uint w, EngineID engine)
| Display list of cargo types of the engine, for the purchase information window.
static int CDECL | VehicleNumberSorter (const void *a, const void *b)
static int CDECL | VehicleNameSorter (const void *a, const void *b)
static int CDECL | VehicleAgeSorter (const void *a, const void *b)
static int CDECL | VehicleProfitThisYearSorter (const void *a, const void *b)
static int CDECL | VehicleProfitLastYearSorter (const void *a, const void *b)
static int CDECL | VehicleCargoSorter (const void *a, const void *b)
static int CDECL | VehicleReliabilitySorter (const void *a, const void *b)
static int CDECL | VehicleMaxSpeedSorter (const void *a, const void *b)
static int CDECL | VehicleModelSorter (const void *a, const void *b)
static int CDECL | VehicleValueSorter (const void *a, const void *b)
void | InitializeGUI ()
void | ChangeVehicleViewWindow (const Vehicle *from_v, const Vehicle *to_v)
| Assigns an already open vehicle window to a new vehicle.
static void | CreateVehicleListWindow (Window *w)
void | DrawSmallOrderList (const Vehicle *v, int x, int y)
static void | DrawVehicleListWindow (Window *w)
void | PlayerVehWndProc (Window *w, WindowEvent *e)
static void | ShowVehicleListWindowLocal (PlayerID player, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number)
void | ShowVehicleListWindow (PlayerID player, VehicleType vehicle_type)
void | ShowVehicleListWindow (const Vehicle *v)
void | ShowVehicleListWindow (PlayerID player, VehicleType vehicle_type, StationID station)
void | ShowVehicleListWindow (PlayerID player, VehicleType vehicle_type, TileIndex depot_tile)
void | CreateVehicleDetailsWindow (Window *w)
| Initialize a newly created vehicle details window.
static bool | IsVehicleServiceIntervalEnabled (const VehicleType vehicle_type)
| Checks whether service interval is enabled for the vehicle.
int | GetTrainDetailsWndVScroll (VehicleID veh_id, byte det_tab)
void | DrawTrainDetails (const Vehicle *v, int x, int y, int vscroll_pos, uint16 vscroll_cap, byte det_tab)
void | DrawRoadVehDetails (const Vehicle *v, int x, int y)
void | DrawShipDetails (const Vehicle *v, int x, int y)
| Draw the details for the given vehicle at the position (x,y).
void | DrawAircraftDetails (const Vehicle *v, int x, int y)
| Draw the details for the given vehicle at the position (x,y).
static void | DrawVehicleDetails (const Vehicle *v, int x, int y, int vscroll_pos, uint vscroll_cap, byte det_tab)
| Draw the details for the given vehicle at the position (x,y) of the Details windows.
static void | DrawVehicleDetailsWindow (Window *w)
| Repaint vehicle details window.
static void | VehicleDetailsWndProc (Window *w, WindowEvent *e)
| Window event hook for vehicle details.
static void | ShowVehicleDetailsWindow (const Vehicle *v)
| Shows the vehicle details window of the given vehicle.
static void | VehicleViewWndProc (Window *w, WindowEvent *e)
| Window event hook for vehicle view.
| assert_compile (VEH_TRAIN==0)
| assert_compile (VEH_ROAD==1)
| assert_compile (VEH_SHIP==2)
| assert_compile (VEH_AIRCRAFT==3)
void | ShowVehicleViewWindow (const Vehicle *v)
| Shows the vehicle view window of the given vehicle.
static void | CreateVehicleViewWindow (Window *w)
| Initialize a newly created vehicle view window.
static bool | IsVehicleRefitable (const Vehicle *v)
| Checks whether the vehicle may be refitted at the moment.
static void | DrawVehicleViewWindow (Window *w)
| Repaint vehicle view window.
void | DrawVehicleImage (const Vehicle *v, int x, int y, VehicleID selection, int count, int skip)
## Variables
static Sorting | _sorting
static bool | _internal_sort_order
static VehicleSortListingTypeFunction | VehicleNumberSorter
static VehicleSortListingTypeFunction | VehicleNameSorter
static VehicleSortListingTypeFunction | VehicleAgeSorter
static VehicleSortListingTypeFunction | VehicleProfitThisYearSorter
static VehicleSortListingTypeFunction | VehicleProfitLastYearSorter
static VehicleSortListingTypeFunction | VehicleCargoSorter
static VehicleSortListingTypeFunction | VehicleReliabilitySorter
static VehicleSortListingTypeFunction | VehicleMaxSpeedSorter
static VehicleSortListingTypeFunction | VehicleModelSorter
static VehicleSortListingTypeFunction | VehicleValueSorter
static VehicleSortListingTypeFunction *const | _vehicle_sorter []
const StringID | _vehicle_sort_listing []
static const Vehicle * | _last_vehicle [2] = { NULL, NULL }
static char | _last_name [2][64] = { "", "" }
static const Widget | _vehicle_refit_widgets []
static const WindowDesc | _vehicle_refit_desc
static const Widget | _vehicle_list_widgets []
static const WindowDesc | _player_vehicle_list_train_desc
static const WindowDesc | _player_vehicle_list_road_veh_desc
static const WindowDesc | _player_vehicle_list_ship_desc
static const WindowDesc | _player_vehicle_list_aircraft_desc
static const Widget | _vehicle_details_widgets []
| Vehicle details widgets.
static const StringID | _vehicle_translation_table [][4]
| Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type.
static const StringID | _name_vehicle_title []
| Message strings for renaming vehicles indexed by vehicle type.
static const StringID | _name_vehicle_error []
| Message strings for error while renaming indexed by vehicle type.
static const WindowDesc | _vehicle_details_desc
| Vehicle details window descriptor.
static const Widget | _vehicle_view_widgets []
| Vehicle view widgets.
static const WindowDesc | _vehicle_view_desc
| Vehicle view window descriptor for all vehicles but trains.
static const WindowDesc | _train_view_desc
| Vehicle view window descriptor for trains.
static const ZoomLevel | _vehicle_view_zoom_levels []
| Zoom levels for vehicle views indexed by vehicle type.
static const int | VV_VIEWPORT_X = 3
static const int | VV_VIEWPORT_Y = 17
static const int | VV_INITIAL_VIEWPORT_WIDTH = 226
static const int | VV_INITIAL_VIEWPORT_HEIGHT = 84
static const int | VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102
static const StringID | _heading_for_depot_strings []
| Message strings for heading to depot indexed by vehicle type.
static const StringID | _heading_for_depot_service_strings []
| Message strings for heading to depot and servicing indexed by vehicle type.
static const uint32 | _vehicle_command_translation_table [][4]
| Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type.

## Detailed Description

Definition in file vehicle_gui.cpp.

## Enumeration Type Documentation

enum VehicleCommandTranslation

Command indices for the _vehicle_command_translation_table.

Definition at line 2013 of file vehicle_gui.cpp.

enum VehicleStringTranslation

Command indices for the _vehicle_command_translation_table.

Definition at line 1321 of file vehicle_gui.cpp.

## Function Documentation

void ChangeVehicleViewWindow | ( | const Vehicle * | from_v,
|  | const Vehicle * | to_v |
| ) |  |  |

Assigns an already open vehicle window to a new vehicle.

Assigns an already open vehicle window to a new vehicle. If the vehicle got any sub window open (orders and so on) it will change owner too.

Parameters:

  | *from_v | the current owner of the window
  | *to_v | the new owner of the window

Definition at line 706 of file vehicle_gui.cpp.

References SetWindowDirty().

void DrawAircraftDetails | ( | const Vehicle * | v,
|  | int | x,
|  | int | y |
| ) |  |  |

Draw the details for the given vehicle at the position (x,y).

Parameters:

  | v | current vehicle
  | x | The x coordinate
  | y | The y coordinate

Definition at line 28 of file aircraft_gui.cpp.

References IsNormalAircraft().

Referenced by DrawVehicleDetails().

void DrawShipDetails | ( | const Vehicle * | v,
|  | int | x,
|  | int | y |
| ) |  |  |

Draw the details for the given vehicle at the position (x,y).

Parameters:

  | v | current vehicle
  | x | The x coordinate
  | y | The y coordinate

Definition at line 51 of file ship_gui.cpp.

Referenced by DrawVehicleDetails().

static void DrawVehicleDetails | ( | const Vehicle * | v,
|  | int | x,
|  | int | y,
|  | int | vscroll_pos,
|  | uint | vscroll_cap,
|  | byte | det_tab |
| ) |  |  | `[inline, static]`

Draw the details for the given vehicle at the position (x,y) of the Details windows.

Parameters:

  | v | current vehicle
  | x | The x coordinate
  | y | The y coordinate
  | vscroll_pos | (train only)
  | vscroll_cap | (train only)
  | det_tab | (train only)

Definition at line 1445 of file vehicle_gui.cpp.

References DrawAircraftDetails(), and DrawShipDetails().

Referenced by DrawVehicleDetailsWindow().

static void DrawVehicleDetailsWindow | ( | Window * | w | ) | `[static]`

Repaint vehicle details window.

Definition at line 1457 of file vehicle_gui.cpp.

References DrawVehicleDetails(), IsVehicleServiceIntervalEnabled(), RAILTYPE_MAGLEV, and WIDGET_LIST_END.

Referenced by VehicleDetailsWndProc().

void DrawVehicleProfitButton | ( | const Vehicle * | v,
|  | int | x,
|  | int | y |
| ) |  |  |

draw the vehicle profit button in the vehicle list window.

Definition at line 174 of file vehicle_gui.cpp.

Referenced by GroupWndProc().

static RefitOption* DrawVehicleRefitWindow | ( | const RefitList * | list,
|  | int | sel,
|  | uint | pos,
|  | uint | rows,
|  | uint | delta |
| ) |  |  | `[static]`

Draw the list of available refit options for a consist.

Draw the list and highlight the selected refit option (if any)

Parameters:

  | *list | first vehicle in consist to get the refit-options of
  | sel | selected refit cargo-type in the window
  | pos | position of the selected item in caller widow
  | rows | number of rows(capacity) in caller window
  | delta | step height in caller window

Returns:
  the refit option that is hightlighted, NULL if none

Definition at line 295 of file vehicle_gui.cpp.

References CALLBACK_FAILED, GetEngineGRFID(), and GetGRFStringID().

static void DrawVehicleViewWindow | ( | Window * | w | ) | `[static]`

Repaint vehicle view window.

Definition at line 1897 of file vehicle_gui.cpp.

References HasBit(), IsVehicleRefitable(), and RAILVEH_WAGON.

Referenced by VehicleViewWndProc().

static bool IsVehicleRefitable | ( | const Vehicle * | v | ) | `[static]`

Checks whether the vehicle may be refitted at the moment.

Definition at line 1866 of file vehicle_gui.cpp.

Referenced by DrawVehicleViewWindow().

static bool IsVehicleServiceIntervalEnabled | ( | const VehicleType | vehicle_type | ) | `[inline, static]`

Checks whether service interval is enabled for the vehicle.

Definition at line 1417 of file vehicle_gui.cpp.

Referenced by DrawVehicleDetailsWindow().

static void ShowVehicleDetailsWindow | ( | const Vehicle * | v | ) | `[static]`

Shows the vehicle details window of the given vehicle.

Definition at line 1641 of file vehicle_gui.cpp.

References AllocateWindowDescFront().

Referenced by VehicleViewWndProc().

void ShowVehicleRefitWindow | ( | const Vehicle * | v,
|  | VehicleOrderID | order |
| ) |  |  |

Show the refit window for a vehicle.

Parameters:

  | *v | The vehicle to show the refit window for
  | order | of the vehicle ( ? )

Definition at line 437 of file vehicle_gui.cpp.

References AllocateWindowDescFront().

Referenced by OrderClick_Refit(), and VehicleViewWndProc().

void ShowVehicleViewWindow | ( | const Vehicle * | v | ) |

Shows the vehicle view window of the given vehicle.

Definition at line 1719 of file vehicle_gui.cpp.

References AllocateWindowDescFront().

Referenced by CcBuildAircraft(), CcCloneVehicle(), CmdSellRailWagon(), and GroupWndProc().

static void VehicleDetailsWndProc | ( | Window * | w,
|  | WindowEvent * | e |
| ) |  |  | `[static]`

Window event hook for vehicle details.

Definition at line 1565 of file vehicle_gui.cpp.

References _cmd_text, _ctrl_pressed, CMD_CHANGE_SERVICE_INT, CMD_MSG, CMD_NAME_VEHICLE, CreateVehicleDetailsWindow(), CS_ALPHANUMERAL, DoCommandP(), DrawVehicleDetailsWindow(), GetServiceIntervalClamped(), ResizeButtons(), SetWindowDirty(), ShowQueryString(), and WIDGET_LIST_END.

static void VehicleViewWndProc | ( | Window * | w,
|  | WindowEvent * | e |
| ) |  |  | `[static]`

Window event hook for vehicle view.

Definition at line 2050 of file vehicle_gui.cpp.

References _ctrl_pressed, CcCloneVehicle(), CMD_FORCE_TRAIN_PROCEED, CMD_MSG, CreateVehicleViewWindow(), DoCommandP(), DrawVehicleViewWindow(), SetWindowDirty(), ShowVehicleDetailsWindow(), and ShowVehicleRefitWindow().

## Variable Documentation

const StringID _heading_for_depot_service_strings[]`[static]`

Initial value:

     {
      STR_HEADING_FOR_TRAIN_DEPOT_SERVICE,
      STR_HEADING_FOR_ROAD_DEPOT_SERVICE,
      STR_HEADING_FOR_SHIP_DEPOT_SERVICE,
      STR_HEADING_FOR_HANGAR_SERVICE,
    }

Message strings for heading to depot and servicing indexed by vehicle type.

Definition at line 1889 of file vehicle_gui.cpp.

const StringID _heading_for_depot_strings[]`[static]`

Initial value:

     {
      STR_HEADING_FOR_TRAIN_DEPOT,
      STR_HEADING_FOR_ROAD_DEPOT,
      STR_HEADING_FOR_SHIP_DEPOT,
      STR_HEADING_FOR_HANGAR,
    }

Message strings for heading to depot indexed by vehicle type.

Definition at line 1881 of file vehicle_gui.cpp.

const StringID _name_vehicle_error[]`[static]`

Initial value:

     {
      STR_8866_CAN_T_NAME_TRAIN,
      STR_902D_CAN_T_NAME_ROAD_VEHICLE,
      STR_9832_CAN_T_NAME_SHIP,
      STR_A031_CAN_T_NAME_AIRCRAFT
    }

Message strings for error while renaming indexed by vehicle type.

Definition at line 1557 of file vehicle_gui.cpp.

const StringID _name_vehicle_title[]`[static]`

Initial value:

     {
      STR_8865_NAME_TRAIN,
      STR_902C_NAME_ROAD_VEHICLE,
      STR_9831_NAME_SHIP,
      STR_A030_NAME_AIRCRAFT
    }

Message strings for renaming vehicles indexed by vehicle type.

Definition at line 1549 of file vehicle_gui.cpp.

const WindowDesc _player_vehicle_list_aircraft_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 260, 182, 260, 182,
      WC_AIRCRAFT_LIST, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_list_widgets,
      PlayerVehWndProc
    }

Definition at line 1195 of file vehicle_gui.cpp.

const WindowDesc _player_vehicle_list_road_veh_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 260, 182, 260, 182,
      WC_ROADVEH_LIST, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_list_widgets,
      PlayerVehWndProc
    }

Definition at line 1179 of file vehicle_gui.cpp.

const WindowDesc _player_vehicle_list_ship_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 260, 182, 260, 182,
      WC_SHIPS_LIST, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_list_widgets,
      PlayerVehWndProc
    }

Definition at line 1187 of file vehicle_gui.cpp.

const WindowDesc _player_vehicle_list_train_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 260, 182, 260, 182,
      WC_TRAINS_LIST, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_list_widgets,
      PlayerVehWndProc
    }

Definition at line 1171 of file vehicle_gui.cpp.

const WindowDesc _train_view_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 250, 134, 250, 134,
      WC_VEHICLE_VIEW, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_view_widgets,
      VehicleViewWndProc
    }

Vehicle view window descriptor for trains.

Only minimum_height and default_height are different for train view.

Definition at line 1687 of file vehicle_gui.cpp.

const uint32 _vehicle_command_translation_table[][4]`[static]`

Initial value:

     {
      {
        CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN),
        CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE),
        CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP),
        CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)
      },
      {

        CMD_SEND_TRAIN_TO_DEPOT | CMD_NO_TEST_IF_IN_NETWORK | CMD_MSG(STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT),
        CMD_SEND_ROADVEH_TO_DEPOT | CMD_MSG(STR_9018_CAN_T_SEND_VEHICLE_TO_DEPOT),
        CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT),
        CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_MSG(STR_A012_CAN_T_SEND_AIRCRAFT_TO)
      },
      {
        CMD_CLONE_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE),
        CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE),
        CMD_CLONE_VEHICLE | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP),
        CMD_CLONE_VEHICLE | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT)
      },
      {
        CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_8869_CAN_T_REVERSE_DIRECTION),
        CMD_TURN_ROADVEH | CMD_MSG(STR_9033_CAN_T_MAKE_VEHICLE_TURN),
        0xffffffff,
        0xffffffff
      },
    }

Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type.

Definition at line 2021 of file vehicle_gui.cpp.

const WindowDesc _vehicle_details_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 405, 113, 405, 113,
      WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
      _vehicle_details_widgets,
      VehicleDetailsWndProc
    }

Vehicle details window descriptor.

Definition at line 1632 of file vehicle_gui.cpp.

const Widget _vehicle_details_widgets[]`[static]`

Initial value:

     {
      {   WWT_CLOSEBOX,   RESIZE_NONE, 14,   0,  10,   0,  13, STR_00C5,             STR_018B_CLOSE_WINDOW},
      {    WWT_CAPTION,  RESIZE_RIGHT, 14,  11, 364,   0,  13, 0x0,                  STR_018C_WINDOW_TITLE_DRAG_THIS},
      { WWT_PUSHTXTBTN,     RESIZE_LR, 14, 365, 404,   0,  13, STR_01AA_NAME,        STR_NULL },
      {      WWT_PANEL,  RESIZE_RIGHT, 14,   0, 404,  14,  55, 0x0,                  STR_NULL},
      { WWT_PUSHTXTBTN,     RESIZE_TB, 14,   0,  10, 101, 106, STR_0188,             STR_884D_INCREASE_SERVICING_INTERVAL},
      { WWT_PUSHTXTBTN,     RESIZE_TB, 14,   0,  10, 107, 112, STR_0189,             STR_884E_DECREASE_SERVICING_INTERVAL},
      {      WWT_PANEL,    RESIZE_RTB, 14,  11, 404, 101, 112, 0x0,                  STR_NULL},
      {     WWT_MATRIX,     RESIZE_RB, 14,   0, 392,  56, 100, 0x701,                STR_NULL},
      {  WWT_SCROLLBAR,    RESIZE_LRB, 14, 393, 404,  56, 100, 0x0,                  STR_0190_SCROLL_BAR_SCROLLS_LIST},
      { WWT_PUSHTXTBTN,     RESIZE_TB, 14,   0,  95, 113, 124, STR_013C_CARGO,       STR_884F_SHOW_DETAILS_OF_CARGO_CARRIED},
      { WWT_PUSHTXTBTN,     RESIZE_TB, 14,  96, 194, 113, 124, STR_013D_INFORMATION, STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES},
      { WWT_PUSHTXTBTN,     RESIZE_TB, 14, 195, 293, 113, 124, STR_013E_CAPACITIES,  STR_8851_SHOW_CAPACITIES_OF_EACH},
      { WWT_PUSHTXTBTN,    RESIZE_RTB, 14, 294, 392, 113, 124, STR_TOTAL_CARGO,      STR_SHOW_TOTAL_CARGO},
      {  WWT_RESIZEBOX,   RESIZE_LRTB, 14, 393, 404, 113, 124, 0x0,                  STR_RESIZE_BUTTON},
      {   WIDGETS_END},
    }

Vehicle details widgets.

Definition at line 1301 of file vehicle_gui.cpp.

const Widget _vehicle_list_widgets[]`[static]`

Initial value:

     {
      {   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,             STR_018B_CLOSE_WINDOW},
      {    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   247,     0,    13, 0x0,                  STR_018C_WINDOW_TITLE_DRAG_THIS},
      {  WWT_STICKYBOX,     RESIZE_LR,    14,   248,   259,     0,    13, 0x0,                  STR_STICKY_BUTTON},
      { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,     0,    80,    14,    25, STR_SORT_BY,          STR_SORT_ORDER_TIP},
      {   WWT_DROPDOWN,   RESIZE_NONE,    14,    81,   247,    14,    25, 0x0,                  STR_SORT_CRITERIA_TIP},
      {      WWT_PANEL,  RESIZE_RIGHT,    14,   248,   259,    14,    25, 0x0,                  STR_NULL},
      {     WWT_MATRIX,     RESIZE_RB,    14,     0,   247,    26,   169, 0x0,                  STR_NULL},
      {  WWT_SCROLLBAR,    RESIZE_LRB,    14,   248,   259,    26,   169, 0x0,                  STR_0190_SCROLL_BAR_SCROLLS_LIST},

      {      WWT_PANEL,    RESIZE_RTB,    14,     0,   247,   170,   181, 0x0,                  STR_NULL},

      { WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   105,   170,   181, 0x0,                  STR_AVAILABLE_ENGINES_TIP},
      {   WWT_DROPDOWN,     RESIZE_TB,    14,   106,   223,   170,   181, STR_MANAGE_LIST,      STR_MANAGE_LIST_TIP},

      { WWT_PUSHIMGBTN,     RESIZE_TB,    14,   224,   235,   170,   181, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP},
      { WWT_PUSHIMGBTN,     RESIZE_TB,    14,   236,   247,   170,   181, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
      {      WWT_PANEL,    RESIZE_RTB,    14,   248,   247,   170,   181, 0x0,                  STR_NULL},
      {  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   248,   259,   170,   181, 0x0,                  STR_RESIZE_BUTTON},
      {   WIDGETS_END},
    }

Definition at line 760 of file vehicle_gui.cpp.

const WindowDesc _vehicle_refit_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 240, 174, 240, 174,
      WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
      _vehicle_refit_widgets,
      VehicleRefitWndProc,
    }

Definition at line 425 of file vehicle_gui.cpp.

const Widget _vehicle_refit_widgets[]`[static]`

Initial value:

     {
      {   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                            STR_018B_CLOSE_WINDOW},
      {    WWT_CAPTION,   RESIZE_NONE,    14,    11,   239,     0,    13, STR_983B_REFIT,                      STR_018C_WINDOW_TITLE_DRAG_THIS},
      {    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,   239,    14,    27, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_983D_SELECT_TYPE_OF_CARGO_FOR},
      {     WWT_MATRIX, RESIZE_BOTTOM,    14,     0,   227,    28,   139, 0x801,                               STR_EMPTY},
      {  WWT_SCROLLBAR, RESIZE_BOTTOM,    14,   228,   239,    28,   139, 0x0,                                 STR_0190_SCROLL_BAR_SCROLLS_LIST},
      {      WWT_PANEL,     RESIZE_TB,    14,     0,   239,   140,   161, 0x0,                                 STR_NULL},
      { WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   227,   162,   173, 0x0,                                 STR_NULL},
      {  WWT_RESIZEBOX,     RESIZE_TB,    14,   228,   239,   162,   173, 0x0,                                 STR_RESIZE_BUTTON},
      {   WIDGETS_END},
    }

Definition at line 413 of file vehicle_gui.cpp.

const StringID _vehicle_sort_listing[]

Initial value:

     {
      STR_SORT_BY_NUMBER,
      STR_SORT_BY_DROPDOWN_NAME,
      STR_SORT_BY_AGE,
      STR_SORT_BY_PROFIT_THIS_YEAR,
      STR_SORT_BY_PROFIT_LAST_YEAR,
      STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE,
      STR_SORT_BY_RELIABILITY,
      STR_SORT_BY_MAX_SPEED,
      STR_SORT_BY_MODEL,
      STR_SORT_BY_VALUE,
      INVALID_STRING_ID
    }

Definition at line 80 of file vehicle_gui.cpp.

VehicleSortListingTypeFunction* const _vehicle_sorter[]`[static]`

Initial value:

     {
      &VehicleNumberSorter,
      &VehicleNameSorter,
      &VehicleAgeSorter,
      &VehicleProfitThisYearSorter,
      &VehicleProfitLastYearSorter,
      &VehicleCargoSorter,
      &VehicleReliabilitySorter,
      &VehicleMaxSpeedSorter,
      &VehicleModelSorter,
      &VehicleValueSorter,
    }

Definition at line 67 of file vehicle_gui.cpp.

const StringID _vehicle_translation_table[][4]`[static]`

Initial value:

     {
      {
        STR_885D_AGE_RUNNING_COST_YR,
        STR_900D_AGE_RUNNING_COST_YR,
        STR_9812_AGE_RUNNING_COST_YR,
        STR_A00D_AGE_RUNNING_COST_YR,
      },
      {
        STR_NULL,
        STR_900E_MAX_SPEED,
        STR_9813_MAX_SPEED,
        STR_A00E_MAX_SPEED,
      },
      {
        STR_885F_PROFIT_THIS_YEAR_LAST_YEAR,
        STR_900F_PROFIT_THIS_YEAR_LAST_YEAR,
        STR_9814_PROFIT_THIS_YEAR_LAST_YEAR,
        STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR,
      },
      {
        STR_8860_RELIABILITY_BREAKDOWNS,
        STR_9010_RELIABILITY_BREAKDOWNS,
        STR_9815_RELIABILITY_BREAKDOWNS,
        STR_A010_RELIABILITY_BREAKDOWNS,
      },
    }

Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type.

Definition at line 1329 of file vehicle_gui.cpp.

const WindowDesc _vehicle_view_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 250, 116, 250, 116,
      WC_VEHICLE_VIEW, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _vehicle_view_widgets,
      VehicleViewWndProc
    }

Vehicle view window descriptor for all vehicles but trains.

Definition at line 1676 of file vehicle_gui.cpp.

const Widget _vehicle_view_widgets[]`[static]`

Initial value:

     {
      {   WWT_CLOSEBOX,  RESIZE_NONE,  14,   0,  10,   0,  13, STR_00C5,                 STR_018B_CLOSE_WINDOW },
      {    WWT_CAPTION, RESIZE_RIGHT,  14,  11, 237,   0,  13, 0x0 ,   STR_018C_WINDOW_TITLE_DRAG_THIS },
      {  WWT_STICKYBOX,    RESIZE_LR,  14, 238, 249,   0,  13, 0x0,                      STR_STICKY_BUTTON },
      {      WWT_PANEL,    RESIZE_RB,  14,   0, 231,  14, 103, 0x0,                      STR_NULL },
      {      WWT_INSET,    RESIZE_RB,  14,   2, 229,  16, 101, 0x0,                      STR_NULL },
      {    WWT_PUSHBTN,   RESIZE_RTB,  14,   0, 237, 104, 115, 0x0,                      0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  14,  31, SPR_CENTRE_VIEW_VEHICLE,  0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  32,  49, 0x0 ,   0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  50,  67, SPR_REFIT_VEHICLE,        0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  68,  85, SPR_SHOW_ORDERS,          0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  86, 103, SPR_SHOW_VEHICLE_DETAILS, 0x0  },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  32,  49, 0x0 ,   0x0  },
      {      WWT_PANEL,   RESIZE_LRB,  14, 232, 249, 104, 103, 0x0,                      STR_NULL },
      {  WWT_RESIZEBOX,  RESIZE_LRTB,  14, 238, 249, 104, 115, 0x0,                      STR_NULL },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  50,  67, SPR_FORCE_VEHICLE_TURN,   STR_9020_FORCE_VEHICLE_TO_TURN_AROUND },
      { WWT_PUSHIMGBTN,    RESIZE_LR,  14, 232, 249,  50,  67, SPR_IGNORE_SIGNALS,       STR_884A_FORCE_TRAIN_TO_PROCEED },
    {   WIDGETS_END},
    }

Vehicle view widgets.

Definition at line 1652 of file vehicle_gui.cpp.

const ZoomLevel _vehicle_view_zoom_levels[]`[static]`

Initial value:

     {
      ZOOM_LVL_TRAIN,
      ZOOM_LVL_ROADVEH,
      ZOOM_LVL_SHIP,
      ZOOM_LVL_AIRCRAFT,
    }

Zoom levels for vehicle views indexed by vehicle type.

Definition at line 1704 of file vehicle_gui.cpp.