OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
46 STR_ORDER_FULL_LOAD_ANY,
51 STR_ORDER_UNLOAD_FULL_LOAD,
52 STR_ORDER_UNLOAD_FULL_LOAD_ANY,
53 STR_ORDER_UNLOAD_NO_LOAD,
57 STR_ORDER_TRANSFER_FULL_LOAD,
58 STR_ORDER_TRANSFER_FULL_LOAD_ANY,
59 STR_ORDER_TRANSFER_NO_LOAD,
69 STR_ORDER_NO_UNLOAD_FULL_LOAD,
70 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
71 STR_ORDER_NO_UNLOAD_NO_LOAD,
78 STR_ORDER_FULL_LOAD_REFIT,
79 STR_ORDER_FULL_LOAD_ANY_REFIT,
82 STR_ORDER_UNLOAD_REFIT,
84 STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
85 STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
88 STR_ORDER_TRANSFER_REFIT,
90 STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
91 STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
100 STR_ORDER_NO_UNLOAD_REFIT,
102 STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
103 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
109 static const StringID _order_non_stop_drowdown[] = {
111 STR_ORDER_GO_NON_STOP_TO,
113 STR_ORDER_GO_NON_STOP_VIA,
117 static const StringID _order_full_load_drowdown[] = {
118 STR_ORDER_DROP_LOAD_IF_POSSIBLE,
120 STR_ORDER_DROP_FULL_LOAD_ALL,
121 STR_ORDER_DROP_FULL_LOAD_ANY,
122 STR_ORDER_DROP_NO_LOADING,
126 static const StringID _order_unload_drowdown[] = {
127 STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
128 STR_ORDER_DROP_UNLOAD,
129 STR_ORDER_DROP_TRANSFER,
131 STR_ORDER_DROP_NO_UNLOADING,
135 static const StringID _order_goto_dropdown[] = {
137 STR_ORDER_GO_TO_NEAREST_DEPOT,
138 STR_ORDER_CONDITIONAL,
143 static const StringID _order_goto_dropdown_aircraft[] = {
145 STR_ORDER_GO_TO_NEAREST_HANGAR,
146 STR_ORDER_CONDITIONAL,
163 static const StringID _order_conditional_condition[] = {
164 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
165 STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
166 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
167 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
168 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
169 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
170 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
171 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
178 static const StringID _order_depot_action_dropdown[] = {
179 STR_ORDER_DROP_GO_ALWAYS_DEPOT,
180 STR_ORDER_DROP_SERVICE_DEPOT,
181 STR_ORDER_DROP_HALT_DEPOT,
185 static int DepotActionStringIndex(
const Order *order)
196 static const StringID _order_refit_action_dropdown[] = {
197 STR_ORDER_DROP_REFIT_AUTO,
198 STR_ORDER_DROP_REFIT_AUTO_ANY,
214 void DrawOrderString(
const Vehicle *v,
const Order *order,
int order_index,
int y,
bool selected,
bool timetable,
int left,
int middle,
int right)
218 SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
222 DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((
int)
FONT_HEIGHT_NORMAL - (
int)sprite_size.height) / 2);
228 if (order->
IsType(OT_IMPLICIT)) {
229 colour = (selected ? TC_SILVER : TC_GREY) |
TC_NO_SHADE;
230 }
else if (selected) {
256 SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
259 case OT_GOTO_STATION: {
264 SetDParam(0, valid_station ? STR_ORDER_GO_TO_STATION : STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION);
289 SetDParam(0, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT);
298 SetDParam(0, STR_ORDER_GO_TO_DEPOT_FORMAT);
313 if (!timetable && order->
IsRefit()) {
319 case OT_GOTO_WAYPOINT:
327 SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
332 SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
347 default: NOT_REACHED();
350 DrawString(rtl ? left : middle, rtl ? middle : right, y, STR_ORDER_TEXT, colour);
410 default: NOT_REACHED();
536 int num = this->selected_order;
565 assert(type > OPOS_NONE && type < OPOS_END);
573 this->goto_type = type;
587 if (order ==
nullptr)
return;
606 if (order ==
nullptr)
return;
618 order.
next =
nullptr;
637 if (order ==
nullptr)
return;
664 if (order ==
nullptr || order->
GetNonStopType() == non_stop)
return;
685 DoCommandP(this->vehicle->
tile, this->vehicle->index,
_ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()),
695 int selected = this->selected_order + (int)
_networking;
698 this->selected_order = selected >= this->vehicle->
GetNumOrders() ? -1 : selected;
699 this->UpdateButtonState();
712 if (!this->vehicle->
IsOrderListShared() || this->selected_order != this->vehicle->GetNumOrders())
return;
723 this->UpdateButtonState();
750 this->can_do_refit =
false;
751 this->can_do_autorefit =
false;
770 this->selected_order = -1;
772 this->goto_type = OPOS_NONE;
779 int station_orders = 0;
781 if (order->
IsType(OT_GOTO_STATION)) station_orders++;
802 d.width += padding.width;
803 d.height += padding.height;
813 d.width += padding.width;
814 d.height += padding.height;
844 if (this->selected_order == -1)
break;
848 this->selected_order = -1;
858 if (gui_scope)
break;
859 from =
GB(data, 0, 8);
863 if (this->selected_order == -1)
break;
865 if (from == to)
break;
867 if (from != this->selected_order) {
869 this->selected_order -= (int)(from <= this->selected_order);
871 this->selected_order += (int)(to <= this->selected_order);
880 this->selected_order = -1;
885 this->selected_order = to;
890 if (gui_scope) this->UpdateButtonState();
898 void UpdateButtonState()
912 if (shared_orders && this->selected_order == this->vehicle->
GetNumOrders()) {
919 (uint)this->vehicle->
GetNumOrders() + ((shared_orders || this->vehicle->GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order);
924 if (this->selected_order == this->vehicle->
GetNumOrders()) {
925 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
927 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
944 assert(row_sel !=
nullptr || (train_row_sel !=
nullptr && left_sel !=
nullptr && middle_sel !=
nullptr && right_sel !=
nullptr));
947 if (order ==
nullptr) {
948 if (row_sel !=
nullptr) {
966 case OT_GOTO_STATION:
967 if (row_sel !=
nullptr) {
984 ((!this->can_do_refit || !this->can_do_autorefit) && !order->
IsRefit()));
988 case OT_GOTO_WAYPOINT:
989 if (row_sel !=
nullptr) {
1005 if (row_sel !=
nullptr) {
1019 (!this->can_do_refit && !order->
IsRefit()));
1023 case OT_CONDITIONAL: {
1024 if (row_sel !=
nullptr) {
1031 this->GetWidget<NWidgetCore>(
WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
1039 if (row_sel !=
nullptr) {
1064 this->selected_order = -1;
1081 int line_height = this->GetWidget<NWidgetBase>(
WID_O_ORDER_LIST)->resize_y;
1087 while (order !=
nullptr) {
1089 if (!this->vscroll->
IsVisible(i))
break;
1091 if (i != this->selected_order && i == this->order_over) {
1093 int top = (this->order_over < this->selected_order ? y : y + line_height) -
WD_FRAMERECT_TOP;
1102 order = order->
next;
1108 order = this->vehicle->
GetOrder(i);
1112 while (order !=
nullptr) {
1114 if (!this->vscroll->
IsVisible(i))
break;
1120 order = order->
next;
1136 if (order !=
nullptr && order->
IsType(OT_CONDITIONAL)) {
1154 if (this->goto_type == OPOS_CONDITIONAL) {
1158 order.
next =
nullptr;
1182 this->selected_order = -1;
1183 }
else if (sel == this->selected_order) {
1185 DoCommandP(this->vehicle->
tile, this->vehicle->index + (sel << 20),
1186 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
1191 this->selected_order = sel;
1199 this->UpdateButtonState();
1216 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1221 o->
IsType(OT_GOTO_STATION) ? 0 : (o->
IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1226 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1227 if (this->goto_type != OPOS_NONE) {
1234 switch (this->goto_type) {
1235 case OPOS_NONE: sel = -1;
break;
1236 case OPOS_GOTO: sel = 0;
break;
1237 case OPOS_CONDITIONAL: sel = 2;
break;
1238 case OPOS_SHARE: sel = 3;
break;
1239 default: NOT_REACHED();
1246 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1254 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1266 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1274 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1310 ShowVehicleListWindow(this->vehicle);
1319 uint value = atoi(str);
1328 value =
Clamp(value, 0, 100);
1359 default: NOT_REACHED();
1390 this->selected_order = -1;
1391 this->UpdateButtonState();
1437 if (this->goto_type == OPOS_GOTO) {
1439 if (cmd.
IsType(OT_NOTHING))
return;
1448 bool OnVehicleSelect(
const Vehicle *v)
override
1455 bool share_order =
_ctrl_pressed || this->goto_type == OPOS_SHARE;
1456 if (this->vehicle->
GetNumOrders() != 0 && !share_order)
return false;
1458 if (
DoCommandP(this->vehicle->
tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->
index,
1460 this->selected_order = -1;
1468 this->goto_type = OPOS_NONE;
1488 this->order_over = to_order;
1507 static Hotkey order_hotkeys[] = {
1508 Hotkey(
'D',
"skip", OHK_SKIP),
1509 Hotkey(
'F',
"delete", OHK_DELETE),
1510 Hotkey(
'G',
"goto", OHK_GOTO),
1511 Hotkey(
'H',
"nonstop", OHK_NONSTOP),
1512 Hotkey(
'J',
"fullload", OHK_FULLLOAD),
1513 Hotkey(
'K',
"unload", OHK_UNLOAD),
1514 Hotkey((uint16)0,
"nearest_depot", OHK_NEAREST_DEPOT),
1515 Hotkey((uint16)0,
"always_service", OHK_ALWAYS_SERVICE),
1516 Hotkey((uint16)0,
"transfer", OHK_TRANSFER),
1517 Hotkey((uint16)0,
"no_unload", OHK_NO_UNLOAD),
1518 Hotkey((uint16)0,
"no_load", OHK_NO_LOAD),
1521 HotkeyList OrdersWindow::hotkeys(
"order", order_hotkeys);
1534 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(),
1584 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1594 WDP_AUTO,
"view_vehicle_orders_train", 384, 100,
1598 &OrdersWindow::hotkeys
1612 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(),
1658 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1667 WDP_AUTO,
"view_vehicle_orders", 384, 100,
1671 &OrdersWindow::hotkeys
1685 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(),
1694 WDP_AUTO,
"view_vehicle_orders_competitor", 384, 86,
1698 &OrdersWindow::hotkeys
1701 void ShowOrdersWindow(
const Vehicle *v)
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ ES_HANDLED
The passed event is handled.
static const NWidgetPart _nested_other_orders_widgets[]
Nested widget definition for competitor orders.
@ DA_STOP
Go to the depot and stop there.
uint ConvertSpeedToDisplaySpeed(uint speed)
Convert the given (internal) speed to the display speed.
StationFacility facilities
The facilities that this station has.
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
byte VehicleOrderID
The index of an order within its current vehicle (not pool related)
bool IsRefit() const
Is this order a refit order.
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
#define CMD_MSG(x)
Used to combine a StringID with the command.
uint32 TileIndex
The index/ID of a Tile.
uint16 GetWaitTime() const
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not).
@ OUFB_UNLOAD
Force unloading all cargo onto the platform, possibly not getting paid.
bool IsType(OrderType type) const
Check whether this order is of the given type.
@ CMD_SKIP_TO_ORDER
skip an order to the next of specific one
static Titem * Get(size_t index)
Returns Titem with given index.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
void OrderClick_Delete()
Handle the click on the delete button.
Vehicle * PreviousShared() const
Get the previous vehicle of the shared vehicle chain.
void SetLoadType(OrderLoadFlags load_type)
Set how the consist must be loaded.
List of hotkeys for a window.
@ CMD_ORDER_REFIT
change the refit information of an order (for "goto depot" )
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
@ MOF_DEPOT_ACTION
Selects the OrderDepotAction.
Dimensions (a width and height) of a rectangle in 2D.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
@ MOF_LOAD
Passes an OrderLoadType.
static bool IsRailWaypointTile(TileIndex t)
Is this tile a station tile and a rail waypoint?
@ ODTFB_SERVICE
This depot order is because of the servicing limit.
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
@ MOF_COND_VALUE
The value to set the condition to.
OrderLoadFlags
Flags related to the loading order.
void OrderClick_StopSharing()
Handle the click on the 'stop sharing' button.
VehicleOrderID order_over
Order over which another order is dragged, INVALID_VEH_ORDER_ID if none.
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
@ OUFB_TRANSFER
Transfer all cargo onto the platform.
DisplayPane
Displayed planes of the NWID_SELECTION widgets.
@ FACIL_TRUCK_STOP
Station with truck stops.
DestinationID GetDestination() const
Gets the destination of this order.
void OrderClick_Skip()
Handle the click on the skip button.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
@ DP_ROW_LOAD
Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window.
uint16 GetConditionValue() const
Get the value to base the skip on.
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.
@ DP_ROW_CONDITIONAL
Display the conditional order buttons in the top row of the ship/airplane order window.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
bool new_nonstop
ttdpatch compatible nonstop handling
void OrderClick_NearestDepot()
Handle the click on the service in nearest depot button.
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
@ MOF_UNLOAD
Passes an OrderUnloadType.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
void Free()
'Free' the order
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static const NWidgetPart _nested_orders_widgets[]
Nested widget definition for "your" orders (non-train).
static bool IsDepotTypeTile(TileIndex tile, TransportType type)
Check if a tile is a depot and it is a depot of the given type.
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
@ CMD_MOVE_ORDER
move an order
bool _ctrl_pressed
Is Ctrl pressed?
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
OrderDepotTypeFlags
Reasons that could cause us to go to the depot.
void UpdateAutoRefitState()
Cache auto-refittability of the vehicle chain.
static Station * Get(size_t index)
Gets station with given index.
ClientSettings _settings_client
The current settings for this game.
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.
@ WC_VEHICLE_TIMETABLE
Vehicle timetable; Window numbers:
@ MP_INDUSTRY
Part of an industry.
void OnMouseDrag(Point pt, int widget) override
An 'object' is being dragged at the provided position, highlight the target if possible.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
@ CMD_INSERT_ORDER
insert a new order
@ SA_RIGHT
Right align the text (must be a single bit).
TransportType
Available types of transport.
@ VEH_ROAD
Road vehicle type.
Defines the internal data of a functional industry.
bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
Owner owner
Which company owns the vehicle?
static const StringID _station_load_types[][5][5]
Order load types that could be given to station orders.
@ MOF_COND_COMPARATOR
A comparator changes.
@ WD_FRAMETEXT_LEFT
Left offset of the text of the frame.
Owner owner
The owner of this station.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
uint16 GetRange() const
Get the range of this aircraft.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
OrderStopLocation
Where to stop the trains.
void OrderClick_Goto(OrderPlaceObjectState type)
Handle the click on the goto button.
void OnResize() override
Called after the window got resized.
Station * neutral_station
Associated neutral station.
void OrderClick_Nonstop(int non_stop)
Handle the click on the nonstop button.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
uint32 Pack() const
Pack this order into a 32 bits integer, or actually only the type, flags and destination.
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.
OrderType GetType() const
Get the type of order of this order.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
OrderStopLocation GetStopLocation() const
Where must we stop at the platform?
@ ONSF_NO_STOP_AT_ANY_STATION
The vehicle will not stop at any stations it passes including the destination.
High level window description.
void OnDragDrop(Point pt, int widget) override
A dragged 'object' has been released.
uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int conditional_depth)
Get the distance between two orders of a vehicle.
static const CursorID ANIMCURSOR_PICKSTATION
716 - 718 - goto-order icon
@ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS
The vehicle will not stop at any stations it passes except the destination.
OrderNonStopFlags GetNonStopType() const
At which stations must we stop?
IterateWrapper Orders() const
Returns an iterable ensemble of orders of a vehicle.
@ FACIL_BUS_STOP
Station with bus stops.
@ OLF_FULL_LOAD_ANY
Full load a single cargo of the consist.
@ EF_AUTO_REFIT
Automatic refitting is allowed.
@ WDP_AUTO
Find a place automatically.
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
CargoID GetRefitCargo() const
Get the cargo to to refit to.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
bool can_do_autorefit
Vehicle chain can be auto-refitted.
ResizeInfo resize
Resize information.
@ ONSF_STOP_EVERYWHERE
The vehicle will stop at any station it passes and the destination.
@ WC_VEHICLE_VIEW
Vehicle view; Window numbers:
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
static const VehicleOrderID INVALID_VEH_ORDER_ID
Invalid vehicle order index (sentinel)
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
static const OrderConditionVariable _order_conditional_variable[]
Variables for conditional orders; this defines the order of appearance in the dropdown box.
TileIndex tile
Current tile index.
void MakeGoToWaypoint(StationID destination)
Makes this order a Go To Waypoint order.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void OrderClick_Service(int i)
Handle the click on the service.
@ OUF_UNLOAD_IF_POSSIBLE
Unload all cargo that the station accepts.
@ ES_NOT_HANDLED
The passed event is not handled.
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
@ DP_MIDDLE_SERVICE
Display 'service' in the middle button of the top row of the train/rv order window.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
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 ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
@ ODATFB_NEAREST_DEPOT
Send the vehicle to the nearest depot.
void OrderClick_FullLoad(OrderLoadFlags load_type, bool toggle=false)
Handle the click on the full load button.
@ DP_GROUNDVEHICLE_ROW_NORMAL
Display the row for normal/depot orders in the top row of the train/rv order window.
VehicleOrderID OrderGetSel() const
Return the memorised selected order.
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
@ OCC_IS_TRUE
Skip if the variable is true.
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
@ DA_ALWAYS_GO
Always go to the depot.
VehicleOrderID GetOrderFromPt(int y)
Calculate the selected order.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
@ ODTFB_PART_OF_ORDERS
This depot order is because of a regular order.
bool IsGotoOrder() const
Is this a 'goto' order with a real destination?
OrderConditionComparator GetConditionComparator() const
What is the comparator to use?
@ TC_NO_SHADE
Do not add shading to this text colour.
bool _networking
are we in networking mode?
@ DP_MIDDLE_UNLOAD
Display 'unload' in the middle button of the top row of the train/rv order window.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
OrderPlaceObjectState
Under what reason are we using the PlaceObject functionality?
Coordinates of a point in 2D.
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.
@ FACIL_DOCK
Station with a dock.
void MakeGoToStation(StationID destination)
Makes this order a Go To Station order.
VehicleOrderID GetConditionSkipToOrder() const
Get the order to skip to.
@ WD_FRAMETEXT_RIGHT
Right offset of the text of the frame.
WindowNumber window_number
Window number within the window class.
@ DP_RIGHT_EMPTY
Display an empty panel in the right button of the top row of the train/rv order window.
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.
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
@ OLF_LOAD_IF_POSSIBLE
Load as long as there is cargo that fits in the train.
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
@ ODATFB_HALT
Service the vehicle and then halt it.
@ HT_VEHICLE
vehicle is accepted as target as well (bitmask)
@ DP_RIGHT_REFIT
Display 'refit' in the right button of the top row of the train/rv order window.
@ HT_DRAG
dragging items in the depot windows
@ VIWD_CONSIST_CHANGED
Vehicle composition was changed.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
@ ONSF_NO_STOP_AT_DESTINATION_STATION
The vehicle will stop at any station it passes except the destination.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
OrderUnloadFlags
Flags related to the unloading order.
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
bool quick_goto
Allow quick access to 'goto button' in vehicle orders window.
EventState OnHotkey(int hotkey) override
A hotkey has been pressed.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
@ OCV_MAX_SPEED
Skip based on the maximum speed.
@ OSL_PLATFORM_FAR_END
Stop at the far end of the platform.
int HideDropDownMenu(Window *pw)
Delete the drop-down menu from window pw.
@ OCV_RELIABILITY
Skip based on the reliability.
@ MOF_STOP_LOCATION
Passes an OrderStopLocation.
@ FACIL_TRAIN
Station with train station.
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
Order * GetFirstOrder() const
Get the first order of the vehicles order list.
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
@ VIWD_AUTOREPLACE
Autoreplace replaced the vehicle.
uint8 stop_location
what is the default stop location of trains?
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
Get the order command a vehicle can do in a given tile.
@ OCV_REMAINING_LIFETIME
Skip based on the remaining lifetime.
@ OUFB_NO_UNLOAD
Totally no unloading will be done.
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.
@ CMD_MODIFY_ORDER
modify an order (like set full-load)
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
@ CMD_DELETE_ORDER
delete an order
@ OWNER_NONE
The tile has no ownership.
@ DP_ROW_DEPOT
Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
@ CT_AUTO_REFIT
Automatically choose cargo type when doing auto refitting.
@ MP_STATION
A tile of a station.
@ MOF_NON_STOP
Passes an OrderNonStopFlags.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
EventState
State of handling an event.
@ HT_RECT
rectangle (stations, depots, ...)
uint ConvertDisplaySpeedToSpeed(uint speed)
Convert the given display speed to the (internal) speed.
Order window code for all vehicles.
void SetDepotOrderType(OrderDepotTypeFlags depot_order_type)
Set the cause to go to the depot.
StringID name
Name of this type of cargo.
bool IsAutoRefit() const
Is this order a auto-refit order.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
void OnPaint() override
The window must be repainted.
void SetDepotActionType(OrderDepotActionFlags depot_service_type)
Set what we are going to do in the depot.
@ OCV_LOAD_PERCENTAGE
Skip based on the amount of load.
int top
y position of top edge of the window
void MakeConditional(VehicleOrderID order)
Makes this order an conditional order.
HighLightStyle
Highlighting draw styles.
OrderDepotTypeFlags GetDepotOrderType() const
What caused us going to the depot?
OrderConditionVariable GetConditionVariable() const
What variable do we have to compare?
#define lengthof(x)
Return the length of an fixed size array.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
OrderConditionVariable
Variables (of a vehicle) to 'cause' skipping on.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
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...
bool can_do_refit
Vehicle chain can be refitted in depot.
TileIndex GetLocation(const Vehicle *v, bool airport=false) const
Returns a tile somewhat representing the order destination (not suitable for pathfinding).
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
bool IsEngineRefittable(EngineID engine)
Check if an engine is refittable.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
@ OCV_REQUIRES_SERVICE
Skip when the vehicle requires service.
Data structure for an opened window.
@ VEH_TRAIN
Train vehicle type.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Order * GetOrder(int index) const
Returns order 'index' of a vehicle or nullptr when it doesn't exists.
@ DP_LEFT_REFIT
Display 'refit' in the left button of the top row of the train/rv order window.
VehicleType type
Type of vehicle.
void OrderClick_Refit(int i, bool auto_refit)
Handle the click on the refit button.
void DrawWidgets() const
Paint all widgets of a window.
@ FACIL_AIRPORT
Station with an airport.
@ DP_LEFT_LOAD
Display 'load' in the left button of the top row of the train/rv order window.
@ VIWD_MODIFY_ORDERS
Other order modifications.
bool CanVehicleUseStation(EngineID engine_type, const Station *st)
Can this station be used by the given engine type?
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
@ VEH_SHIP
Ship vehicle type.
@ OCV_MAX_RELIABILITY
Skip based on the maximum reliability.
Specification of a rectangle with absolute coordinates of all edges.
@ DP_GROUNDVEHICLE_ROW_CONDITIONAL
Display the row for conditional orders in the top row of the train/rv order window.
Point pos
logical mouse position
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
@ OCC_IS_FALSE
Skip if the variable is false.
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
@ VIWD_REMOVE_ALL_ORDERS
Removed / replaced all orders (after deleting / sharing).
@ CT_NO_REFIT
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.
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
Show the refit window for a vehicle.
void OrderClick_Unload(OrderUnloadFlags unload_type, bool toggle=false)
Handle the click on the unload button.
void DisableWidget(byte widget_index)
Sets a widget to disabled.
static const NWidgetPart _nested_orders_train_widgets[]
Nested widget definition for "your" train orders.
Order * next
Pointer to next order. If nullptr, end of list.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
@ DA_SERVICE
Service only if needed.
@ TD_RTL
Text is written right-to-left by default.
TextDirection _current_text_dir
Text direction of the currently selected language.
@ CS_NUMERAL
Only numeric ones.
@ OCV_AGE
Skip based on the age.
bool IsWaitTimetabled() const
Does this order have an explicit wait time set?
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
static DepotID GetDepotIndex(TileIndex t)
Get the index of which depot is attached to the tile.
OrderConditionComparator
Comparator for the skip reasoning.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
@ WC_VEHICLE_ORDERS
Vehicle orders; Window numbers:
GUISettings gui
settings related to the GUI
@ OCV_UNCONDITIONALLY
Always skip.
@ OLFB_NO_LOAD
Do not load anything.
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
@ MOF_COND_VARIABLE
A conditional variable changes.
All data for a single hotkey.
@ CMD_CLONE_ORDER
clone (and share) an order
@ DP_BOTTOM_MIDDLE_STOP_SHARING
Display 'stop sharing' in the middle button of the bottom row of the vehicle order window.
const Vehicle * vehicle
Vehicle owning the orders being displayed and manipulated.
@ DP_BOTTOM_MIDDLE_DELETE
Display 'delete' in the middle button of the bottom row of the vehicle order window.