45 STR_ORDER_FULL_LOAD_ANY,
50 STR_ORDER_UNLOAD_FULL_LOAD,
51 STR_ORDER_UNLOAD_FULL_LOAD_ANY,
52 STR_ORDER_UNLOAD_NO_LOAD,
56 STR_ORDER_TRANSFER_FULL_LOAD,
57 STR_ORDER_TRANSFER_FULL_LOAD_ANY,
58 STR_ORDER_TRANSFER_NO_LOAD,
68 STR_ORDER_NO_UNLOAD_FULL_LOAD,
69 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
70 STR_ORDER_NO_UNLOAD_NO_LOAD,
77 STR_ORDER_FULL_LOAD_REFIT,
78 STR_ORDER_FULL_LOAD_ANY_REFIT,
81 STR_ORDER_UNLOAD_REFIT,
83 STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
84 STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
87 STR_ORDER_TRANSFER_REFIT,
89 STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
90 STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
99 STR_ORDER_NO_UNLOAD_REFIT,
101 STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
102 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
108 static const StringID _order_non_stop_drowdown[] = {
110 STR_ORDER_GO_NON_STOP_TO,
112 STR_ORDER_GO_NON_STOP_VIA,
116 static const StringID _order_full_load_drowdown[] = {
117 STR_ORDER_DROP_LOAD_IF_POSSIBLE,
119 STR_ORDER_DROP_FULL_LOAD_ALL,
120 STR_ORDER_DROP_FULL_LOAD_ANY,
121 STR_ORDER_DROP_NO_LOADING,
125 static const StringID _order_unload_drowdown[] = {
126 STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
127 STR_ORDER_DROP_UNLOAD,
128 STR_ORDER_DROP_TRANSFER,
130 STR_ORDER_DROP_NO_UNLOADING,
134 static const StringID _order_goto_dropdown[] = {
136 STR_ORDER_GO_TO_NEAREST_DEPOT,
137 STR_ORDER_CONDITIONAL,
142 static const StringID _order_goto_dropdown_aircraft[] = {
144 STR_ORDER_GO_TO_NEAREST_HANGAR,
145 STR_ORDER_CONDITIONAL,
162 static const StringID _order_conditional_condition[] = {
163 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
164 STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
165 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
166 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
167 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
168 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
169 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
170 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
177 static const StringID _order_depot_action_dropdown[] = {
178 STR_ORDER_DROP_GO_ALWAYS_DEPOT,
179 STR_ORDER_DROP_SERVICE_DEPOT,
180 STR_ORDER_DROP_HALT_DEPOT,
184 static int DepotActionStringIndex(
const Order *order)
195 static const StringID _order_refit_action_dropdown[] = {
196 STR_ORDER_DROP_REFIT_AUTO,
197 STR_ORDER_DROP_REFIT_AUTO_ANY,
213 void DrawOrderString(
const Vehicle *v,
const Order *order,
int order_index,
int y,
bool selected,
bool timetable,
int left,
int middle,
int right)
217 SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
221 DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((
int)
FONT_HEIGHT_NORMAL - (
int)sprite_size.height) / 2);
227 if (order->
IsType(OT_IMPLICIT)) {
228 colour = (selected ? TC_SILVER : TC_GREY) |
TC_NO_SHADE;
229 }
else if (selected) {
255 SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
258 case OT_GOTO_STATION: {
287 SetDParam(0, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT);
296 SetDParam(0, STR_ORDER_GO_TO_DEPOT_FORMAT);
311 if (!timetable && order->
IsRefit()) {
317 case OT_GOTO_WAYPOINT:
325 SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
330 SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
345 default: NOT_REACHED();
348 DrawString(rtl ? left : middle, rtl ? middle : right, y, STR_ORDER_TEXT, colour);
408 default: NOT_REACHED();
534 int num = this->selected_order;
535 return (num >= 0 && num < vehicle->GetNumOrders()) ? num : vehicle->
GetNumOrders();
563 assert(type > OPOS_NONE && type < OPOS_END);
571 this->goto_type = type;
584 if (order ==
nullptr || order->
GetLoadType() == load_type)
return;
609 if (order ==
nullptr)
return;
621 order.
next =
nullptr;
638 if (order ==
nullptr || order->
GetUnloadType() == unload_type)
return;
640 if (unload_type < 0) {
680 if (order ==
nullptr || order->
GetNonStopType() == non_stop)
return;
711 int selected = this->selected_order + (int)
_networking;
714 this->selected_order = selected >= this->vehicle->
GetNumOrders() ? -1 : selected;
715 this->UpdateButtonState();
739 this->UpdateButtonState();
766 this->can_do_refit =
false;
767 this->can_do_autorefit =
false;
786 this->selected_order = -1;
788 this->goto_type = OPOS_NONE;
795 int station_orders = 0;
797 FOR_VEHICLE_ORDERS(v, order) {
798 if (order->
IsType(OT_GOTO_STATION)) station_orders++;
819 d.width += padding.width;
820 d.height += padding.height;
830 d.width += padding.width;
831 d.height += padding.height;
861 if (this->selected_order == -1)
break;
865 this->selected_order = -1;
875 if (gui_scope)
break;
876 from =
GB(data, 0, 8);
880 if (this->selected_order == -1)
break;
882 if (from == to)
break;
884 if (from != this->selected_order) {
886 this->selected_order -= (int)(from <= this->selected_order);
888 this->selected_order += (int)(to <= this->selected_order);
897 this->selected_order = -1;
902 this->selected_order = to;
907 if (gui_scope) this->UpdateButtonState();
915 void UpdateButtonState()
929 if (shared_orders && this->selected_order == this->vehicle->
GetNumOrders()) {
936 (uint)this->vehicle->
GetNumOrders() + ((shared_orders || this->vehicle->
GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order);
941 if (this->selected_order == this->vehicle->
GetNumOrders()) {
942 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
944 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
961 assert(row_sel !=
nullptr || (train_row_sel !=
nullptr && left_sel !=
nullptr && middle_sel !=
nullptr && right_sel !=
nullptr));
964 if (order ==
nullptr) {
965 if (row_sel !=
nullptr) {
983 case OT_GOTO_STATION:
984 if (row_sel !=
nullptr) {
1001 ((!this->can_do_refit || !this->can_do_autorefit) && !order->
IsRefit()));
1005 case OT_GOTO_WAYPOINT:
1006 if (row_sel !=
nullptr) {
1022 if (row_sel !=
nullptr) {
1036 (!this->can_do_refit && !order->
IsRefit()));
1040 case OT_CONDITIONAL: {
1041 if (row_sel !=
nullptr) {
1048 this->GetWidget<NWidgetCore>(
WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
1056 if (row_sel !=
nullptr) {
1081 this->selected_order = -1;
1098 int line_height = this->GetWidget<NWidgetBase>(
WID_O_ORDER_LIST)->resize_y;
1104 while (order !=
nullptr) {
1106 if (!this->vscroll->
IsVisible(i))
break;
1108 if (i != this->selected_order && i == this->order_over) {
1110 int top = (this->order_over < this->selected_order ? y : y + line_height) -
WD_FRAMERECT_TOP;
1119 order = order->
next;
1125 order = this->vehicle->
GetOrder(i);
1129 while (order !=
nullptr) {
1131 if (!this->vscroll->
IsVisible(i))
break;
1137 order = order->
next;
1153 if (order !=
nullptr && order->
IsType(OT_CONDITIONAL)) {
1171 if (this->goto_type == OPOS_CONDITIONAL) {
1175 order.
next =
nullptr;
1199 this->selected_order = -1;
1200 }
else if (sel == this->selected_order) {
1202 DoCommandP(this->vehicle->
tile, this->vehicle->index + (sel << 20),
1203 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
1208 this->selected_order = sel;
1216 this->UpdateButtonState();
1233 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1238 o->
IsType(OT_GOTO_STATION) ? 0 : (o->
IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1243 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1244 if (this->goto_type != OPOS_NONE) {
1251 switch (this->goto_type) {
1252 case OPOS_NONE: sel = -1;
break;
1253 case OPOS_GOTO: sel = 0;
break;
1254 case OPOS_CONDITIONAL: sel = 2;
break;
1255 case OPOS_SHARE: sel = 3;
break;
1256 default: NOT_REACHED();
1263 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1271 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1283 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1291 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1327 ShowVehicleListWindow(this->vehicle);
1336 uint value = atoi(str);
1345 value =
Clamp(value, 0, 100);
1376 default: NOT_REACHED();
1407 this->selected_order = -1;
1408 this->UpdateButtonState();
1454 if (this->goto_type == OPOS_GOTO) {
1456 if (cmd.
IsType(OT_NOTHING))
return;
1465 bool OnVehicleSelect(
const Vehicle *v)
override 1472 bool share_order =
_ctrl_pressed || this->goto_type == OPOS_SHARE;
1473 if (this->vehicle->
GetNumOrders() != 0 && !share_order)
return false;
1475 if (
DoCommandP(this->vehicle->
tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->
index,
1477 this->selected_order = -1;
1485 this->goto_type = OPOS_NONE;
1505 this->order_over = to_order;
1524 static Hotkey order_hotkeys[] = {
1525 Hotkey(
'D',
"skip", OHK_SKIP),
1526 Hotkey(
'F',
"delete", OHK_DELETE),
1527 Hotkey(
'G',
"goto", OHK_GOTO),
1528 Hotkey(
'H',
"nonstop", OHK_NONSTOP),
1529 Hotkey(
'J',
"fullload", OHK_FULLLOAD),
1530 Hotkey(
'K',
"unload", OHK_UNLOAD),
1531 Hotkey((uint16)0,
"nearest_depot", OHK_NEAREST_DEPOT),
1532 Hotkey((uint16)0,
"always_service", OHK_ALWAYS_SERVICE),
1533 Hotkey((uint16)0,
"transfer", OHK_TRANSFER),
1534 Hotkey((uint16)0,
"no_unload", OHK_NO_UNLOAD),
1535 Hotkey((uint16)0,
"no_load", OHK_NO_LOAD),
1538 HotkeyList OrdersWindow::hotkeys(
"order", order_hotkeys);
1551 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_O_ORDER_LIST),
SetMinimalSize(372, 62),
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP),
SetResize(1, 1),
SetScrollbar(
WID_O_SCROLLBAR),
EndContainer(),
1601 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1611 WDP_AUTO,
"view_vehicle_orders_train", 384, 100,
1614 _nested_orders_train_widgets,
lengthof(_nested_orders_train_widgets),
1615 &OrdersWindow::hotkeys
1629 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_O_ORDER_LIST),
SetMinimalSize(372, 62),
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP),
SetResize(1, 1),
SetScrollbar(
WID_O_SCROLLBAR),
EndContainer(),
1675 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1684 WDP_AUTO,
"view_vehicle_orders", 384, 100,
1687 _nested_orders_widgets,
lengthof(_nested_orders_widgets),
1688 &OrdersWindow::hotkeys
1702 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_O_ORDER_LIST),
SetMinimalSize(372, 72),
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP),
SetResize(1, 1),
SetScrollbar(
WID_O_SCROLLBAR),
EndContainer(),
1711 WDP_AUTO,
"view_vehicle_orders_competitor", 384, 86,
1714 _nested_other_orders_widgets,
lengthof(_nested_other_orders_widgets),
1715 &OrdersWindow::hotkeys
1718 void ShowOrdersWindow(
const Vehicle *v)
OrderConditionVariable
Variables (of a vehicle) to 'cause' skipping on.
EventState
State of handling an event.
void OrderClick_NearestDepot()
Handle the click on the service in nearest depot button.
Functions related to OTTD's strings.
Display the row for normal/depot orders in the top row of the train/rv order window.
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width)
Show a dropdown menu window near a widget of the parent window.
static const StringID _station_load_types[][5][5]
Order load types that could be given to station orders.
StationFacility facilities
The facilities that this station has.
uint ConvertSpeedToDisplaySpeed(uint speed)
Convert the given (internal) speed to the display speed.
bool _networking
are we in networking mode?
Passes an OrderUnloadType.
ResizeInfo resize
Resize information.
void OrderClick_StopSharing()
Handle the click on the 'stop sharing' button.
bool quick_goto
Allow quick access to 'goto button' in vehicle orders window.
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen...
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Point pos
logical mouse position
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Load as long as there is cargo that fits in the train.
void OrderClick_Skip()
Handle the click on the skip button.
bool IsGotoOrder() const
Is this a 'goto' order with a real destination?
OrderConditionComparator GetConditionComparator() const
What is the comparator to use?
All data for a single hotkey.
High level window description.
static const NWidgetPart _nested_other_orders_widgets[]
Nested widget definition for competitor orders.
void DrawWidgets() const
Paint all widgets of a window.
static Titem * Get(size_t index)
Returns Titem with given index.
Hotkey related functions.
static const NWidgetPart _nested_orders_widgets[]
Nested widget definition for "your" orders (non-train).
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
void OrderClick_Refit(int i, bool auto_refit)
Handle the click on the refit button.
Vehicle composition was changed.
VehicleOrderID GetConditionSkipToOrder() const
Get the order to skip to.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
static const VehicleOrderID INVALID_VEH_ORDER_ID
Invalid vehicle order index (sentinel)
Offset at top to draw the frame rectangular area.
Other order modifications.
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
The passed event is not handled.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
void SetDepotOrderType(OrderDepotTypeFlags depot_order_type)
Set the cause to go to the depot.
void OrderClick_Unload(int unload_type)
Handle the click on the unload button.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
void SetDepotActionType(OrderDepotActionFlags depot_service_type)
Set what we are going to do in the depot.
uint8 stop_location
what is the default stop location of trains?
const Vehicle * vehicle
Vehicle owning the orders being displayed and manipulated.
Selects the OrderDepotAction.
Skip if the variable is true.
Skip based on the reliability.
int top
y position of top edge of the window
Unload all cargo that the station accepts.
Defines the internal data of a functional industry.
Tindex index
Index of this pool item.
bool can_do_autorefit
Vehicle chain can be auto-refitted.
Display 'refit' in the left button of the top row of the train/rv order window.
static bool IsRailWaypointTile(TileIndex t)
Is this tile a station tile and a rail waypoint?
void OrderClick_Nonstop(int non_stop)
Handle the click on the nonstop button.
clone (and share) an order
Stuff related to the text buffer GUI.
void UpdateAutoRefitState()
Cache auto-refittability of the vehicle chain.
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Automatically choose cargo type when doing auto refitting.
void OrderClick_Goto(OrderPlaceObjectState type)
Handle the click on the goto button.
Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
static T max(const T a, const T b)
Returns the maximum of two values.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
TileIndex GetLocation(const Vehicle *v, bool airport=false) const
Returns a tile somewhat representing the order destination (not suitable for pathfinding).
void OnPaint() override
The window must be repainted.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
void OnMouseDrag(Point pt, int widget) override
An 'object' is being dragged at the provided position, highlight the target if possible.
int HideDropDownMenu(Window *pw)
Delete the drop-down menu from window pw.
Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
OrderDepotActionFlags GetDepotActionType() const
What are we going to do when in the depot.
skip an order to the next of specific one
The vehicle will stop at any station it passes except the destination.
uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int conditional_depth)
Get the distance between two orders of a vehicle.
Order * next
Pointer to next order. If nullptr, end of list.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
Force the alignment, i.e. don't swap for RTL languages.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
bool IsAutoRefit() const
Is this order a auto-refit order.
Functions related to (drawing on) viewports.
Display 'load' in the left button of the top row of the train/rv order window.
bool IsEngineRefittable(EngineID engine)
Check if an engine is refittable.
Data structure for an opened window.
bool _ctrl_pressed
Is Ctrl pressed?
Stop at the far end of the platform.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
The vehicle will stop at any station it passes and the destination.
Autoreplace replaced the vehicle.
void MakeConditional(VehicleOrderID order)
Makes this order an conditional order.
dragging items in the depot windows
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
Passes an OrderStopLocation.
OrderDepotTypeFlags GetDepotOrderType() const
What caused us going to the depot?
Vehicle orders; Window numbers:
DisplayPane
Displayed planes of the NWID_SELECTION widgets.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Map related accessors for depots.
Functions related to low-level strings.
OrderConditionVariable GetConditionVariable() const
What variable do we have to compare?
Display the row for conditional orders in the top row of the train/rv order window.
The tile has no ownership.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right)
Draws an order in order or timetable GUI.
void OrderClick_Service(int i)
Handle the click on the service.
This window is used for construction; close it whenever changing company.
bool IsRefit() const
Is this order a refit order.
The vehicle will not stop at any stations it passes including the destination.
Functions related to engines.
bool can_do_refit
Vehicle chain can be refitted in depot.
static bool IsDepotTypeTile(TileIndex tile, TransportType type)
Check if a tile is a depot and it is a depot of the given type.
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
Show the refit window for a vehicle.
bool IsType(OrderType type) const
Check whether this order is of the given type.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
ClientSettings _settings_client
The current settings for this game.
Definition of base types and functions in a cross-platform compatible way.
Removed / replaced all orders (after deleting / sharing).
A number of safeguards to prevent using unsafe methods.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
List of hotkeys for a window.
static const CursorID ANIMCURSOR_PICKSTATION
716 - 718 - goto-order icon
rectangle (stations, depots, ...)
void DeleteChildWindows(WindowClass wc=WC_INVALID) const
Delete all children a window might have in a head-recursive manner.
VehicleOrderID OrderGetSel() const
Return the memorised selected order.
void OrderHotkey_Transfer()
Handle the transfer hotkey.
OrderPlaceObjectState
Under what reason are we using the PlaceObject functionality?
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
uint16 GetRange() const
Get the range of this aircraft.
Vehicle view; Window numbers:
Order window code for all vehicles.
bool IsWaitTimetabled() const
Does this order have an explicit wait time set?
TileIndex tile
Current tile index.
Display 'stop sharing' in the middle button of the bottom row of the vehicle order window...
Vehicle timetable; Window numbers:
Offset at bottom to draw the frame rectangular area.
OrderConditionComparator
Comparator for the skip reasoning.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
static const OrderConditionVariable _order_conditional_variable[]
Variables for conditional orders; this defines the order of appearance in the dropdown box...
Basic functions/variables used all over the place.
Service the vehicle and then halt it.
Owner owner
Which company owns the vehicle?
Right offset of the text of the frame.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
#define lengthof(x)
Return the length of an fixed size array.
void OnDragDrop(Point pt, int widget) override
A dragged 'object' has been released.
static T min(const T a, const T b)
Returns the minimum of two values.
Left offset of the text of the frame.
Types related to the drop down widget.
EventState OnHotkey(int hotkey) override
A hotkey has been pressed.
Display the conditional order buttons in the top row of the ship/airplane order window.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Order * GetFirstOrder() const
Get the first order of the vehicles order list.
The value to set the condition to.
Skip based on the remaining lifetime.
static DepotID GetDepotIndex(TileIndex t)
Get the index of which depot is attached to the tile.
Transfer all cargo onto the platform.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
VehicleOrderID GetOrderFromPt(int y)
Calculate the selected order.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void SetLoadType(OrderLoadFlags load_type)
Set how the consist must be loaded.
Skip when the vehicle requires service.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
OrderUnloadFlags
Flags related to the unloading order.
uint16 GetWaitTime() const
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not)...
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Display 'delete' in the middle button of the bottom row of the vehicle order window.
void OrderClick_FullLoad(int load_type)
Handle the click on the full load button.
A conditional variable changes.
Functions related to companies.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
OrderStopLocation
Where to stop the trains.
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
Passes an OrderNonStopFlags.
Automatic refitting is allowed.
bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
VehicleOrderID order_over
Order over which another order is dragged, INVALID_VEH_ORDER_ID if none.
GUISettings gui
settings related to the GUI
DestinationID GetDestination() const
Gets the destination of this order.
void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type=ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action=ODATF_SERVICE_ONLY, CargoID cargo=CT_NO_REFIT)
Makes this order a Go To Depot order.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
OrderStopLocation GetStopLocation() const
Where must we stop at the platform?
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
uint32 TileIndex
The index/ID of a Tile.
OrderLoadFlags
Flags related to the loading order.
TextDirection _current_text_dir
Text direction of the currently selected language.
void OrderHotkey_NoLoad()
Handle the 'no loading' hotkey.
Vehicle * PreviousShared() const
Get the previous vehicle of the shared vehicle chain.
void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
Send the vehicle to the nearest depot.
void Free()
'Free' the order
uint16 GetConditionValue() const
Get the value to base the skip on.
TransportType
Available types of transport.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Do not add shading to this text colour.
VehicleType type
Type of vehicle.
Skip based on the amount of load.
change the refit information of an order (for "goto depot" )
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
uint ConvertDisplaySpeedToSpeed(uint speed)
Convert the given display speed to the (internal) speed.
Functions related to the drop down widget.
Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window...
Totally no unloading will be done.
The vehicle will not stop at any stations it passes except the destination.
Skip based on the maximum speed.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Vehicle details; Window numbers:
Station * neutral_station
Associated neutral station.
Display 'service' in the middle button of the top row of the train/rv order window.
Functions related to commands.
Coordinates of a point in 2D.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Owner owner
The owner of this station.
Order * GetOrder(int index) const
Returns order 'index' of a vehicle or nullptr when it doesn't exists.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable...
HighLightStyle
Highlighting draw styles.
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
void MakeGoToWaypoint(StationID destination)
Makes this order a Go To Waypoint order.
vehicle is accepted as target as well (bitmask)
byte VehicleOrderID
The index of an order within its current vehicle (not pool related)
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Station with truck stops.
uint32 Pack() const
Pack this order into a 32 bits integer, or actually only the type, flags and destination.
void OnResize() override
Called after the window got resized.
#define CMD_MSG(x)
Used to combine a StringID with the command.
OrderType GetType() const
Get the type of order of this order.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Specification of a rectangle with absolute coordinates of all edges.
bool new_nonstop
ttdpatch compatible nonstop handling
The passed event is handled.
Text is written right-to-left by default.
Right align the text (must be a single bit).
WindowNumber window_number
Window number within the window class.
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Functions related to tile highlights.
Station with train station.
Find a place automatically.
Force unloading all cargo onto the platform, possibly not getting paid.
static const NWidgetPart _nested_orders_train_widgets[]
Nested widget definition for "your" train orders.
Display an empty panel in the right button of the top row of the train/rv order window.
This depot order is because of a regular order.
Go to the depot and stop there.
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
Base classes/functions for stations.
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
Get the order command a vehicle can do in a given tile.
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
Full load a single cargo of the consist.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
This depot order is because of the servicing limit.
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
Skip if the variable is false.
Dimensions (a width and height) of a rectangle in 2D.
Skip based on the maximum reliability.
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
OrderNonStopFlags GetNonStopType() const
At which stations must we stop?
Display 'refit' in the right button of the top row of the train/rv order window.
modify an order (like set full-load)
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Display 'unload' in the middle button of the top row of the train/rv order window.
void MakeGoToStation(StationID destination)
Makes this order a Go To Station order.
OrderDepotTypeFlags
Reasons that could cause us to go to the depot.
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
CargoID GetRefitCargo() const
Get the cargo to to refit to.
void OrderHotkey_NoUnload()
Handle the 'no unload' hotkey.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
void OrderClick_Delete()
Handle the click on the delete button.