OpenTTD
|
The base GUI for all vehicles. More...
#include "stdafx.h"
#include "debug.h"
#include "company_func.h"
#include "gui.h"
#include "textbuf_gui.h"
#include "command_func.h"
#include "vehicle_gui_base.h"
#include "viewport_func.h"
#include "newgrf_text.h"
#include "newgrf_debug.h"
#include "roadveh.h"
#include "train.h"
#include "aircraft.h"
#include "depot_map.h"
#include "group_gui.h"
#include "strings_func.h"
#include "vehicle_func.h"
#include "autoreplace_gui.h"
#include "string_func.h"
#include "widgets/dropdown_func.h"
#include "timetable.h"
#include "articulated_vehicles.h"
#include "spritecache.h"
#include "core/geometry_func.hpp"
#include "company_base.h"
#include "engine_func.h"
#include "station_base.h"
#include "tilehighlight_func.h"
#include "zoom_func.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | RefitOption |
Option to refit a vehicle chain. More... | |
struct | RefitWindow |
Refit cargo window. More... | |
struct | VehicleListWindow |
Window for the (old) vehicle listing. More... | |
struct | VehicleDetailsWindow |
Class for managing the vehicle details window. More... | |
struct | VehicleViewWindow |
Window manager class for viewing a vehicle. More... |
Typedefs | |
typedef SmallVector < RefitOption, 32 > | SubtypeList |
List of refit subtypes associated to a cargo. |
Enumerations | |
enum | VehicleCommandTranslation { VCT_CMD_START_STOP = 0, VCT_CMD_CLONE_VEH, VCT_CMD_TURN_AROUND } |
Command indices for the _vehicle_command_translation_table. More... |
Functions | |
uint | GetUnitNumberDigits (VehicleList &vehicles) |
Get the number of digits the biggest unit number of a set of vehicles has. | |
void | DepotSortList (VehicleList *list) |
static void | DrawVehicleProfitButton (const Vehicle *v, int x, int y) |
draw the vehicle profit button in the vehicle list window. | |
byte | GetBestFittingSubType (Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_type) |
Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for. | |
static void | DrawVehicleRefitWindow (const SubtypeList list[NUM_CARGO], const int sel[2], uint pos, uint rows, uint delta, const Rect &r) |
Draw the list of available refit options for a consist and highlight the selected refit option (if any). | |
void | ShowVehicleRefitWindow (const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit) |
Show the refit window for a vehicle. | |
uint | ShowRefitOptionsList (int left, int right, int y, 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. | |
static int CDECL | VehicleNumberSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their number. | |
static int CDECL | VehicleNameSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their name. | |
static int CDECL | VehicleAgeSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their age. | |
static int CDECL | VehicleProfitThisYearSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by this year profit. | |
static int CDECL | VehicleProfitLastYearSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by last year profit. | |
static int CDECL | VehicleCargoSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their cargo. | |
static int CDECL | VehicleReliabilitySorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their reliability. | |
static int CDECL | VehicleMaxSpeedSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their max speed. | |
static int CDECL | VehicleModelSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by model. | |
static int CDECL | VehicleValueSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their value. | |
static int CDECL | VehicleLengthSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by their length. | |
static int CDECL | VehicleTimeToLiveSorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by the time they can still live. | |
static int CDECL | VehicleTimetableDelaySorter (const Vehicle *const *a, const Vehicle *const *b) |
Sort vehicles by the timetable delay. | |
void | InitializeGUI () |
static void | ChangeVehicleWindow (WindowClass window_class, VehicleID from_index, VehicleID to_index) |
Assign a vehicle window a new vehicle. | |
void | ChangeVehicleViewWindow (VehicleID from_index, VehicleID to_index) |
Report a change in vehicle IDs (due to autoreplace) to affected vehicle windows. | |
static void | DrawSmallOrderList (const Vehicle *v, int left, int right, int y, VehicleOrderID start=0) |
void | DrawVehicleImage (const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip) |
Draws an image of a vehicle chain. | |
uint | GetVehicleListHeight (VehicleType type, uint divisor) |
Get the height of a vehicle in the vehicle list GUIs. | |
static void | ShowVehicleListWindowLocal (CompanyID company, VehicleListType vlt, VehicleType vehicle_type, uint32 unique_number) |
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type) |
void | ShowVehicleListWindow (const Vehicle *v) |
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type, StationID station) |
void | ShowVehicleListWindow (CompanyID company, VehicleType vehicle_type, TileIndex depot_tile) |
assert_compile (WID_VD_DETAILS_CARGO_CARRIED==WID_VD_DETAILS_CARGO_CARRIED+TDW_TAB_CARGO) | |
assert_compile (WID_VD_DETAILS_TRAIN_VEHICLES==WID_VD_DETAILS_CARGO_CARRIED+TDW_TAB_INFO) | |
assert_compile (WID_VD_DETAILS_CAPACITY_OF_EACH==WID_VD_DETAILS_CARGO_CARRIED+TDW_TAB_CAPACITY) | |
assert_compile (WID_VD_DETAILS_TOTAL_CARGO==WID_VD_DETAILS_CARGO_CARRIED+TDW_TAB_TOTALS) | |
int | GetTrainDetailsWndVScroll (VehicleID veh_id, TrainDetailsWindowTabs det_tab) |
Determines the number of lines in the train details window. | |
void | DrawTrainDetails (const Train *v, int left, int right, int y, int vscroll_pos, uint16 vscroll_cap, TrainDetailsWindowTabs det_tab) |
Draw the details for the given vehicle at the given position. | |
void | DrawRoadVehDetails (const Vehicle *v, int left, int right, int y) |
Draw the details for the given vehicle at the given position. | |
void | DrawShipDetails (const Vehicle *v, int left, int right, int y) |
Draw the details for the given vehicle at the given position. | |
void | DrawAircraftDetails (const Aircraft *v, int left, int right, int y) |
Draw the details for the given vehicle at the given position. | |
static void | ShowVehicleDetailsWindow (const Vehicle *v) |
Shows the vehicle details window of the given vehicle. | |
assert_compile (VEH_TRAIN==0) | |
assert_compile (VEH_ROAD==1) | |
assert_compile (VEH_SHIP==2) | |
assert_compile (VEH_AIRCRAFT==3) | |
void | CcStartStopVehicle (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) |
This is the Callback method after the cloning attempt of a vehicle. | |
void | StartStopVehicle (const Vehicle *v, bool texteffect) |
Executes CMD_START_STOP_VEHICLE for given vehicle. | |
static bool | IsVehicleRefitable (const Vehicle *v) |
Checks whether the vehicle may be refitted at the moment. | |
void | ShowVehicleViewWindow (const Vehicle *v) |
Shows the vehicle view window of the given vehicle. | |
bool | VehicleClicked (const Vehicle *v) |
Dispatch a "vehicle selected" event if any window waits for it. | |
void | StopGlobalFollowVehicle (const Vehicle *v) |
void | CcBuildPrimaryVehicle (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) |
This is the Callback method after the construction attempt of a primary vehicle. | |
int | GetVehicleWidth (Vehicle *v, EngineImageType image_type) |
Get the width of a vehicle (including all parts of the consist) in pixels. |
Variables | |
Sorting | _sorting |
static GUIVehicleList::SortFunction | VehicleNumberSorter |
static GUIVehicleList::SortFunction | VehicleNameSorter |
static GUIVehicleList::SortFunction | VehicleAgeSorter |
static GUIVehicleList::SortFunction | VehicleProfitThisYearSorter |
static GUIVehicleList::SortFunction | VehicleProfitLastYearSorter |
static GUIVehicleList::SortFunction | VehicleCargoSorter |
static GUIVehicleList::SortFunction | VehicleReliabilitySorter |
static GUIVehicleList::SortFunction | VehicleMaxSpeedSorter |
static GUIVehicleList::SortFunction | VehicleModelSorter |
static GUIVehicleList::SortFunction | VehicleValueSorter |
static GUIVehicleList::SortFunction | VehicleLengthSorter |
static GUIVehicleList::SortFunction | VehicleTimeToLiveSorter |
static GUIVehicleList::SortFunction | VehicleTimetableDelaySorter |
static const Vehicle * | _last_vehicle [2] = { NULL, NULL } |
static const uint | MAX_REFIT_CYCLE = 256 |
Maximum number of refit cycles we try, to prevent infinite loops. | |
static const NWidgetPart | _nested_vehicle_refit_widgets [] |
static WindowDesc | _vehicle_refit_desc (WDP_AUTO,"view_vehicle_refit", 240, 174, WC_VEHICLE_REFIT, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_vehicle_refit_widgets, lengthof(_nested_vehicle_refit_widgets)) |
static const NWidgetPart | _nested_vehicle_list [] |
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 const NWidgetPart | _nested_nontrain_vehicle_details_widgets [] |
Vehicle details widgets (other than train). | |
static const NWidgetPart | _nested_train_vehicle_details_widgets [] |
Train details widgets. | |
static StringID | _service_interval_dropdown [] |
static WindowDesc | _train_vehicle_details_desc (WDP_AUTO,"view_vehicle_details_train", 405, 178, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, 0, _nested_train_vehicle_details_widgets, lengthof(_nested_train_vehicle_details_widgets)) |
Vehicle details window descriptor. | |
static WindowDesc | _nontrain_vehicle_details_desc (WDP_AUTO,"view_vehicle_details", 405, 113, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, 0, _nested_nontrain_vehicle_details_widgets, lengthof(_nested_nontrain_vehicle_details_widgets)) |
Vehicle details window descriptor for other vehicles than a train. | |
static const NWidgetPart | _nested_vehicle_view_widgets [] |
Vehicle view widgets. | |
static WindowDesc | _vehicle_view_desc (WDP_AUTO,"view_vehicle", 250, 116, WC_VEHICLE_VIEW, WC_NONE, 0, _nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets)) |
Vehicle view window descriptor for all vehicles but trains. | |
static WindowDesc | _train_view_desc (WDP_AUTO,"view_vehicle_train", 250, 134, WC_VEHICLE_VIEW, WC_NONE, 0, _nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets)) |
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_INITIAL_VIEWPORT_WIDTH = 226 |
static const int | VV_INITIAL_VIEWPORT_HEIGHT = 84 |
static const int | VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102 |
static const uint32 | _vehicle_command_translation_table [][4] |
Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type. |
The base GUI for all vehicles.
Definition in file vehicle_gui.cpp.
Command indices for the _vehicle_command_translation_table.
Definition at line 2346 of file vehicle_gui.cpp.
void CcBuildPrimaryVehicle | ( | const CommandCost & | result, |
TileIndex | tile, | ||
uint32 | p1, | ||
uint32 | p2 | ||
) |
This is the Callback method after the construction attempt of a primary vehicle.
result | indicates completion (or not) of the operation |
tile | unused |
p1 | unused |
p2 | unused |
Definition at line 2823 of file vehicle_gui.cpp.
References CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), and ShowVehicleViewWindow().
Referenced by BuildVehicleWindow::OnClick().
void CcStartStopVehicle | ( | const CommandCost & | result, |
TileIndex | tile, | ||
uint32 | p1, | ||
uint32 | p2 | ||
) |
This is the Callback method after the cloning attempt of a vehicle.
result | the result of the cloning command |
tile | unused |
p1 | vehicle ID |
p2 | unused |
Definition at line 2381 of file vehicle_gui.cpp.
References _local_company, DAY_TICKS, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Vehicle::IsPrimaryVehicle(), Vehicle::owner, RemapCoords(), TE_RISING, Vehicle::vehstatus, VS_STOPPED, Vehicle::x_pos, Vehicle::y_pos, and Vehicle::z_pos.
Referenced by StartStopVehicle().
Report a change in vehicle IDs (due to autoreplace) to affected vehicle windows.
from_index | the old vehicle ID |
to_index | the new vehicle ID |
Definition at line 1243 of file vehicle_gui.cpp.
References ChangeVehicleWindow(), WC_VEHICLE_DETAILS, WC_VEHICLE_ORDERS, WC_VEHICLE_REFIT, WC_VEHICLE_TIMETABLE, and WC_VEHICLE_VIEW.
Referenced by CopyHeadSpecificThings().
|
inlinestatic |
Assign a vehicle window a new vehicle.
window_class | WindowClass to search for |
from_index | the old vehicle ID |
to_index | the new vehicle ID |
Definition at line 1220 of file vehicle_gui.cpp.
References FindWindowById(), ViewportData::follow_vehicle, Window::InvalidateData(), Window::viewport, VIWD_AUTOREPLACE, TileHighlightData::window_class, TileHighlightData::window_number, and Window::window_number.
Referenced by ChangeVehicleViewWindow().
void DrawAircraftDetails | ( | const Aircraft * | v, |
int | left, | ||
int | right, | ||
int | y | ||
) |
Draw the details for the given vehicle at the given position.
v | current vehicle |
left | The left most coordinate to draw |
right | The right most coordinate to draw |
y | The y coordinate |
Definition at line 34 of file aircraft_gui.cpp.
References Vehicle::cargo_cap, DrawString(), FONT_HEIGHT_NORMAL, GetCargoSubtypeText(), SpecializedVehicle< T, Type >::Next(), and SetDParam().
Referenced by VehicleDetailsWindow::DrawVehicleDetails().
void DrawRoadVehDetails | ( | const Vehicle * | v, |
int | left, | ||
int | right, | ||
int | y | ||
) |
Draw the details for the given vehicle at the given position.
v | current vehicle |
left | The left most coordinate to draw |
right | The right most coordinate to draw |
y | The y coordinate |
Definition at line 32 of file roadveh_gui.cpp.
References Vehicle::build_year, Vehicle::cargo, Vehicle::cargo_cap, Vehicle::cargo_type, DrawString(), Vehicle::engine_type, VehicleCargoList::FeederShare(), FONT_HEIGHT_NORMAL, GetCargoSubtypeText(), Vehicle::HasArticulatedPart(), lastof, Vehicle::Next(), NUM_CARGO, ScaleGUITrad(), SetDParam(), VehicleCargoList::Source(), VehicleCargoList::StoredCount(), strecat(), and Vehicle::value.
Referenced by VehicleDetailsWindow::DrawVehicleDetails().
void DrawShipDetails | ( | const Vehicle * | v, |
int | left, | ||
int | right, | ||
int | y | ||
) |
Draw the details for the given vehicle at the given position.
v | current vehicle |
left | The left most coordinate to draw |
right | The right most coordinate to draw |
y | The y coordinate |
Definition at line 63 of file ship_gui.cpp.
References Vehicle::build_year, Vehicle::cargo, Vehicle::cargo_cap, Vehicle::cargo_type, DrawString(), Vehicle::engine_type, VehicleCargoList::FeederShare(), FONT_HEIGHT_NORMAL, GetCargoSubtypeText(), SetDParam(), VehicleCargoList::Source(), VehicleCargoList::StoredCount(), and Vehicle::value.
Referenced by VehicleDetailsWindow::DrawVehicleDetails().
void DrawTrainDetails | ( | const Train * | v, |
int | left, | ||
int | right, | ||
int | y, | ||
int | vscroll_pos, | ||
uint16 | vscroll_cap, | ||
TrainDetailsWindowTabs | det_tab | ||
) |
Draw the details for the given vehicle at the given position.
v | current vehicle |
left | The left most coordinate to draw |
right | The right most coordinate to draw |
y | The y coordinate |
vscroll_pos | Position of scrollbar |
vscroll_cap | Number of lines currently displayed |
det_tab | Selected details tab |
Definition at line 353 of file train_gui.cpp.
References _colour_gradient, _current_text_dir, _settings_game, DIR_E, DIR_W, DrawSprite(), DrawString(), EIT_IN_DETAILS, Vehicle::engine_type, FONT_HEIGHT_NORMAL, VehicleSettings::freight_trains, FreightWagonMult(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetCargoSummaryOfArticulatedVehicle(), Train::GetDisplayImageWidth(), Engine::GetGRF(), Train::GetImage(), SpecializedVehicle< T, Type >::GetNextVehicle(), GetVehicleHeight(), GetVehiclePalette(), GfxFillRect(), Vehicle::IsArticulatedPart(), SmallVector< T, S >::Length(), max(), SpecializedVehicle< T, Type >::Next(), NUM_CARGO, PALETTE_CRASH, ScaleGUITrad(), SetDParam(), TD_RTL, TDW_TAB_CAPACITY, TDW_TAB_CARGO, TDW_TAB_INFO, TDW_TAB_TOTALS, TRAIN_DETAILS_MAX_INDENT, TRAIN_DETAILS_MIN_INDENT, TrainDetailsCapacityTab(), TrainDetailsCargoTab(), TrainDetailsInfoTab(), GRFFile::traininfo_vehicle_pitch, VEH_TRAIN, GameSettings::vehicle, Vehicle::vehstatus, VS_CRASHED, WD_MATRIX_BOTTOM, and WD_MATRIX_TOP.
Referenced by VehicleDetailsWindow::DrawVehicleDetails().
void DrawVehicleImage | ( | const Vehicle * | v, |
int | left, | ||
int | right, | ||
int | y, | ||
VehicleID | selection, | ||
EngineImageType | image_type, | ||
int | skip | ||
) |
Draws an image of a vehicle chain.
v | Front vehicle |
left | The minimum horizontal position |
right | The maximum horizontal position |
y | Vertical position to draw at |
selection | Selected vehicle to draw a frame around |
skip | Number of pixels to skip at the front (for scrolling) |
Definition at line 1333 of file vehicle_gui.cpp.
References DrawAircraftImage(), DrawRoadVehImage(), DrawShipImage(), DrawTrainImage(), SpecializedVehicle< Train, Type >::From(), BaseVehicle::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by BaseVehicleListWindow::DrawVehicleListItems(), RefitWindow::DrawWidget(), and VehicleDetailsWindow::DrawWidget().
|
static |
draw the vehicle profit button in the vehicle list window.
Definition at line 201 of file vehicle_gui.cpp.
References Vehicle::age, DrawSprite(), Vehicle::GetDisplayProfitLastYear(), VEHICLE_PROFIT_MIN_AGE, and VEHICLE_PROFIT_THRESHOLD.
Referenced by BaseVehicleListWindow::DrawVehicleListItems().
|
static |
Draw the list of available refit options for a consist and highlight the selected refit option (if any).
list | List of subtype options for each (sorted) cargo. |
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 |
r | Rectangle of the matrix widget. |
Definition at line 331 of file vehicle_gui.cpp.
References _colour_gradient, _current_text_dir, RefitOption::cargo, DrawSprite(), DrawString(), FONT_HEIGHT_NORMAL, CargoSpec::Get(), GetSpriteSize(), SmallVector< T, S >::Length(), max(), CargoSpec::name, NUM_CARGO, SetDParam(), RefitOption::string, RefitOption::subtype, TD_RTL, WD_MATRIX_LEFT, WD_MATRIX_RIGHT, and WD_MATRIX_TOP.
Referenced by RefitWindow::DrawWidget().
Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for.
All articulated parts of both vehicles are tested to find a possibly shared subtype. For v_for only vehicle refittable to dest_cargo_type are considered.
v_from | the vehicle to match the subtype from |
v_for | the vehicle to get the subtype for |
dest_cargo_type | Destination cargo type. |
Definition at line 230 of file vehicle_gui.cpp.
References EngineInfo::callback_mask, Engine::CanCarryCargo(), CBM_VEHICLE_CARGO_SUFFIX, SmallVector< T, S >::Clear(), SmallVector< T, S >::Contains(), GetCargoSubtypeText(), Vehicle::GetEngine(), Vehicle::GetFirstEnginePart(), Vehicle::GetNextArticulatedPart(), Vehicle::HasArticulatedPart(), HasBit(), SmallVector< T, S >::Include(), SmallVector< T, S >::Length(), and MAX_REFIT_CYCLE.
Referenced by BuildReplacementVehicle(), CmdCloneVehicle(), LinkRefresher::HandleRefit(), and RefitVehicle().
Get the cargo subtype text from NewGRF for the vehicle details window.
Definition at line 1072 of file vehicle_gui.cpp.
References CALLBACK_FAILED, CBID_VEHICLE_CARGO_SUFFIX, CBM_VEHICLE_CARGO_SUFFIX, Vehicle::engine_type, ErrorUnknownCallbackResult(), Vehicle::GetGRF(), Vehicle::GetGRFID(), GetGRFStringID(), GetVehicleCallback(), and HasBit().
Referenced by RefitWindow::BuildRefitList(), DrawAircraftDetails(), DrawRoadVehDetails(), DrawShipDetails(), GetBestFittingSubType(), and GetCargoSummaryOfArticulatedVehicle().
int GetTrainDetailsWndVScroll | ( | VehicleID | veh_id, |
TrainDetailsWindowTabs | det_tab | ||
) |
Determines the number of lines in the train details window.
veh_id | Train |
det_tab | Selected details tab |
Definition at line 310 of file train_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), SpecializedVehicle< Train, Type >::Get(), GetCargoSummaryOfArticulatedVehicle(), GetLengthOfArticulatedVehicle(), SpecializedVehicle< T, Type >::GetNextVehicle(), SmallVector< T, S >::Length(), max(), NUM_CARGO, TDW_TAB_TOTALS, and TRAIN_DETAILS_MAX_INDENT.
Referenced by VehicleDetailsWindow::OnPaint().
uint GetUnitNumberDigits | ( | VehicleList & | vehicles | ) |
Get the number of digits the biggest unit number of a set of vehicles has.
vehicles | The list of vehicles. |
Definition at line 106 of file vehicle_gui.cpp.
References SmallVector< T, S >::Begin(), and SmallVector< T, S >::End().
Referenced by DepotWindow::OnPaint().
uint GetVehicleListHeight | ( | VehicleType | type, |
uint | divisor | ||
) |
Get the height of a vehicle in the vehicle list GUIs.
type | the vehicle type to look at |
divisor | the resulting height must be dividable by this |
Definition at line 1350 of file vehicle_gui.cpp.
References FONT_HEIGHT_SMALL, GetVehicleHeight(), max(), ScaleGUITrad(), and VEH_SHIP.
Referenced by VehicleGroupWindow::UpdateWidgetSize(), and VehicleListWindow::UpdateWidgetSize().
int GetVehicleWidth | ( | Vehicle * | v, |
EngineImageType | image_type | ||
) |
Get the width of a vehicle (including all parts of the consist) in pixels.
v | Vehicle to get the width for. |
Definition at line 2836 of file vehicle_gui.cpp.
References _current_text_dir, DIR_E, DIR_W, SpecializedVehicle< Train, Type >::From(), SpecializedVehicle< RoadVehicle, Type >::From(), Train::GetDisplayImageWidth(), Vehicle::GetImage(), SpecializedVehicle< T, Type >::Next(), ST_NORMAL, TD_RTL, BaseVehicle::type, UnScaleGUI(), VEH_ROAD, VEH_TRAIN, and Sprite::width.
Referenced by RefitWindow::OnInvalidateData(), and RefitWindow::OnResize().
|
static |
Checks whether the vehicle may be refitted at the moment.
Definition at line 2405 of file vehicle_gui.cpp.
References Vehicle::engine_type, IsEngineRefittable(), Vehicle::IsGroundVehicle(), Vehicle::IsStoppedInDepot(), and Vehicle::Next().
Referenced by VehicleViewWindow::OnPaint().
|
static |
Shows the vehicle details window of the given vehicle.
Definition at line 2254 of file vehicle_gui.cpp.
References _nontrain_vehicle_details_desc, _train_vehicle_details_desc, DeleteWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, BaseVehicle::type, VEH_TRAIN, WC_VEHICLE_ORDERS, and WC_VEHICLE_TIMETABLE.
Referenced by VehicleViewWindow::OnClick().
void ShowVehicleRefitWindow | ( | const Vehicle * | v, |
VehicleOrderID | order, | ||
Window * | parent, | ||
bool | auto_refit | ||
) |
Show the refit window for a vehicle.
*v | The vehicle to show the refit window for |
order | of the vehicle to assign refit to, or INVALID_VEH_ORDER_ID to refit the vehicle now |
parent | the parent window of the refit window |
auto_refit | Choose cargo for auto-refitting |
Definition at line 1035 of file vehicle_gui.cpp.
References DeleteWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Window::parent, and WC_VEHICLE_REFIT.
Referenced by VehicleViewWindow::OnClick(), and OrdersWindow::OrderClick_Refit().
void ShowVehicleViewWindow | ( | const Vehicle * | v | ) |
Shows the vehicle view window of the given vehicle.
Definition at line 2785 of file vehicle_gui.cpp.
References _train_view_desc, _vehicle_view_desc, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, BaseVehicle::type, and VEH_TRAIN.
Referenced by CcBuildPrimaryVehicle(), CcCloneVehicle(), DepotWindow::DepotClick(), NewsWindow::OnClick(), VehicleListWindow::OnClick(), and DepotWindow::OnDragDrop().
void StartStopVehicle | ( | const Vehicle * | v, |
bool | texteffect | ||
) |
Executes CMD_START_STOP_VEHICLE for given vehicle.
v | Vehicle to start/stop |
texteffect | Should a texteffect be shown? |
Definition at line 2398 of file vehicle_gui.cpp.
References CcStartStopVehicle(), DoCommandP(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Vehicle::IsPrimaryVehicle(), Vehicle::tile, and BaseVehicle::type.
Referenced by DepotWindow::DepotClick(), and VehicleViewWindow::OnClick().
bool VehicleClicked | ( | const Vehicle * | v | ) |
Dispatch a "vehicle selected" event if any window waits for it.
v | selected vehicle; |
Definition at line 2795 of file vehicle_gui.cpp.
References Vehicle::First(), TileHighlightData::GetCallbackWnd(), HT_VEHICLE, Vehicle::IsPrimaryVehicle(), Window::OnVehicleSelect(), and TileHighlightData::place_mode.
Referenced by DepotWindow::DepotClick(), VehicleGroupWindow::OnClick(), and VehicleListWindow::OnClick().
|
static |
Vehicle details widgets (other than train).
Definition at line 1791 of file vehicle_gui.cpp.
|
static |
Train details widgets.
Definition at line 1815 of file vehicle_gui.cpp.
|
static |
Definition at line 995 of file vehicle_gui.cpp.
|
static |
Vehicle view widgets.
Definition at line 2265 of file vehicle_gui.cpp.
|
static |
Vehicle details window descriptor for other vehicles than a train.
Referenced by ShowVehicleDetailsWindow().
|
static |
Definition at line 1858 of file vehicle_gui.cpp.
|
static |
Vehicle details window descriptor.
Referenced by ShowVehicleDetailsWindow().
|
static |
Vehicle view window descriptor for trains.
Only minimum_height and default_height are different for train view.
Referenced by ShowVehicleViewWindow().
|
static |
Command codes for the shared buttons indexed by VehicleCommandTranslation and vehicle type.
Definition at line 2353 of file vehicle_gui.cpp.
|
static |
Vehicle view window descriptor for all vehicles but trains.
Referenced by ShowVehicleViewWindow().
|
static |
Zoom levels for vehicle views indexed by vehicle type.
Definition at line 2333 of file vehicle_gui.cpp.
|
static |
Maximum number of refit cycles we try, to prevent infinite loops.
And we store only a byte anyway
Definition at line 219 of file vehicle_gui.cpp.
Referenced by RefitWindow::BuildRefitList(), and GetBestFittingSubType().