# vehicle_gui.h File Reference

Functions related to the vehicle's GUIs. More...

`#include "window_type.h"`
`#include "vehicle_type.h"`
`#include "order_type.h"`
`#include "station_type.h"`
`#include "engine_type.h"`
`#include "waypoint.h"`

Go to the source code of this file.

## Enumerations
enum | VehicleViewWindowWidgets { VVW_WIDGET_CLOSEBOX = 0, VVW_WIDGET_CAPTION, VVW_WIDGET_STICKY, VVW_WIDGET_PANEL, VVW_WIDGET_VIEWPORT, VVW_WIDGET_START_STOP_VEH, VVW_WIDGET_CENTER_MAIN_VIEH, VVW_WIDGET_GOTO_DEPOT, VVW_WIDGET_REFIT_VEH, VVW_WIDGET_SHOW_ORDERS, VVW_WIDGET_SHOW_DETAILS, VVW_WIDGET_CLONE_VEH, VVW_WIDGET_EMPTY_BOTTOM_RIGHT, VVW_WIDGET_RESIZE, VVW_WIDGET_TURN_AROUND, VVW_WIDGET_FORCE_PROCEED }
| Constants of vehicle view widget indices.
enum | { VLW_STANDARD = 0 << 8, VLW_SHARED_ORDERS = 1 << 8, VLW_STATION_LIST = 2 << 8, VLW_DEPOT_LIST = 3 << 8, VLW_GROUP_LIST = 4 << 8, VLW_WAYPOINT_LIST = 5 << 8, VLW_MASK = 0x700 }
| Vehicle List Window type flags.
## Functions
void | DrawVehicleProfitButton (const Vehicle *v, int x, int y)
| draw the vehicle profit button in the vehicle list window.
void | ShowVehicleRefitWindow (const Vehicle *v, VehicleOrderID order, Window *parent)
| Show the refit window for a vehicle.
static bool | ValidVLWFlags (uint16 flags)
int | DrawVehiclePurchaseInfo (int x, int y, uint w, EngineID engine_number)
| Draw the purchase info details of a vehicle at a given location.
void | DrawTrainImage (const Vehicle *v, int x, int y, VehicleID selection, int count, int skip)
void | DrawRoadVehImage (const Vehicle *v, int x, int y, VehicleID selection, int count)
void | DrawShipImage (const Vehicle *v, int x, int y, VehicleID selection)
void | DrawAircraftImage (const Vehicle *v, int x, int y, VehicleID selection)
void | ShowBuildVehicleWindow (TileIndex tile, VehicleType type)
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.
StringID | GetCargoSubtypeText (const Vehicle *v)
| Get the cargo subtype text from NewGRF for the vehicle details window.
void | ShowVehicleListWindow (const Vehicle *v)
void | ShowVehicleListWindow (const Waypoint *wp)
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type)
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type, StationID station)
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type, TileIndex depot_tile)
void | ChangeVehicleViewWindow (VehicleID from_index, VehicleID to_index)
| Report a change in vehicle IDs (due to autoreplace) to affected vehicle windows.
static uint | GetVehicleListHeight (VehicleType type)
static WindowClass | GetWindowClassForVehicleType (VehicleType vt)
| Get WindowClass for vehicle list of given vehicle type.
void | ShowVehicleViewWindow (const Vehicle *v)
| Shows the vehicle view window of the given vehicle.
Vehicle * | CheckClickOnVehicle (const struct ViewPort *vp, int x, int y)

## Detailed Description

Functions related to the vehicle's GUIs.

Definition in file vehicle_gui.h.

## Function Documentation

void ChangeVehicleViewWindow | ( | VehicleID | from_index,
|  | VehicleID | to_index |
| ) |  |  |

Report a change in vehicle IDs (due to autoreplace) to affected vehicle windows.

Parameters:

  | from_index | the old vehicle ID
  | to_index | the new vehicle ID

Definition at line 670 of file vehicle_gui.cpp.

References ChangeVehicleWindow().

Referenced by CopyHeadSpecificThings().

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

draw the vehicle profit button in the vehicle list window.

Definition at line 112 of file vehicle_gui.cpp.

References DAYS_IN_YEAR, and DrawSprite().

int DrawVehiclePurchaseInfo | ( | int | x,
|  | int | y,
|  | uint | w,
|  | EngineID | engine_number |
| ) |  |  |

Draw the purchase info details of a vehicle at a given location.

Parameters:

  | x,y | location where to draw the info
  | w | how wide are the text allowed to be (size of widget/window to Draw in)
  | engine_number | the engine of which to draw the info of

Returns:
  y after drawing all the text

Definition at line 543 of file build_vehicle_gui.cpp.

References ConvertDateToYMD(), DrawString(), IsArticulatedVehicleRefittable(), RAILVEH_WAGON, ShowAdditionalText(), ShowRefitOptionsList(), and YearMonthDay::year.

Referenced by ReplaceVehicleWindow::OnPaint().

StringID GetCargoSubtypeText | ( | const Vehicle * | v | ) |

Get the cargo subtype text from NewGRF for the vehicle details window.

Definition at line 499 of file vehicle_gui.cpp.

References CALLBACK_FAILED, CBID_VEHICLE_CARGO_SUFFIX, CBM_VEHICLE_CARGO_SUFFIX, GetEngineGRFID(), GetGRFStringID(), GetVehicleCallback(), and HasBit().

Referenced by DrawAircraftDetails(), and DrawShipDetails().

static WindowClass GetWindowClassForVehicleType | ( | VehicleType | vt | ) | `[inline, static]`

Get WindowClass for vehicle list of given vehicle type.

Parameters:

  | vt | vehicle type to check

Returns:
  corresponding window class

Note:
  works only for company buildable vehicle types

Definition at line 88 of file vehicle_gui.h.

Referenced by CmdAddSharedVehicleGroup(), CmdAddVehicleGroup(), CmdCloneOrder(), CmdCreateGroup(), CmdDeleteGroup(), CmdDeleteOrder(), CmdInsertOrder(), CmdMoveOrder(), CmdRemoveAllVehiclesGroup(), CmdRenameGroup(), CmdSetGroupReplaceProtection(), DecloneOrder(), DeleteGroupHighlightOfVehicle(), LoadUnloadVehicle(), and ProcessOrders().

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

Show the refit window for a vehicle.

Parameters:

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

Definition at line 426 of file vehicle_gui.cpp.

References DeleteWindowById().

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

Shows the vehicle view window of the given vehicle.

Definition at line 2029 of file vehicle_gui.cpp.

References _train_view_desc, and _vehicle_view_desc.

Referenced by CcBuildAircraft(), CcCloneVehicle(), CmdSellRailWagon(), and VehicleListWindow::OnClick().