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,
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);
526 int num = this->selected_order;
527 return (num >= 0 && num < vehicle->GetNumOrders()) ? num : vehicle->
GetNumOrders();
555 assert(type > OPOS_NONE && type < OPOS_END);
563 this->goto_type = type;
576 if (order == NULL || order->
GetLoadType() == load_type)
return;
601 if (order == NULL)
return;
630 if (order == NULL || order->
GetUnloadType() == unload_type)
return;
632 if (unload_type < 0) {
703 int selected = this->selected_order + (int)
_networking;
706 this->selected_order = selected >= this->vehicle->
GetNumOrders() ? -1 : selected;
707 this->UpdateButtonState();
731 this->UpdateButtonState();
758 this->can_do_refit =
false;
759 this->can_do_autorefit =
false;
778 this->selected_order = -1;
780 this->goto_type = OPOS_NONE;
787 int station_orders = 0;
789 FOR_VEHICLE_ORDERS(v, order) {
790 if (order->
IsType(OT_GOTO_STATION)) station_orders++;
811 d.width += padding.width;
812 d.height += padding.height;
822 d.width += padding.width;
823 d.height += padding.height;
853 if (this->selected_order == -1)
break;
857 this->selected_order = -1;
867 if (gui_scope)
break;
868 from =
GB(data, 0, 8);
872 if (this->selected_order == -1)
break;
874 if (from == to)
break;
876 if (from != this->selected_order) {
878 this->selected_order -= (int)(from <= this->selected_order);
880 this->selected_order += (int)(to <= this->selected_order);
889 this->selected_order = -1;
894 this->selected_order = to;
899 if (gui_scope) this->UpdateButtonState();
907 void UpdateButtonState()
921 if (shared_orders && this->selected_order == this->vehicle->
GetNumOrders()) {
928 (uint)this->vehicle->
GetNumOrders() + ((shared_orders || this->vehicle->
GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order);
933 if (this->selected_order == this->vehicle->
GetNumOrders()) {
934 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
936 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
953 assert(row_sel != NULL || (train_row_sel != NULL && left_sel != NULL && middle_sel != NULL && right_sel != NULL));
957 if (row_sel != NULL) {
975 case OT_GOTO_STATION:
976 if (row_sel != NULL) {
993 ((!this->can_do_refit || !this->can_do_autorefit) && !order->
IsRefit()));
997 case OT_GOTO_WAYPOINT:
998 if (row_sel != NULL) {
1014 if (row_sel != NULL) {
1028 (!this->can_do_refit && !order->
IsRefit()));
1032 case OT_CONDITIONAL: {
1033 if (row_sel != NULL) {
1040 this->GetWidget<NWidgetCore>(
WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
1048 if (row_sel != NULL) {
1073 this->selected_order = -1;
1090 int line_height = this->GetWidget<NWidgetBase>(
WID_O_ORDER_LIST)->resize_y;
1096 while (order != NULL) {
1098 if (!this->vscroll->
IsVisible(i))
break;
1100 if (i != this->selected_order && i == this->order_over) {
1102 int top = (this->order_over < this->selected_order ? y : y + line_height) -
WD_FRAMERECT_TOP;
1111 order = order->
next;
1117 order = this->vehicle->
GetOrder(i);
1121 while (order != NULL) {
1123 if (!this->vscroll->
IsVisible(i))
break;
1129 order = order->
next;
1145 if (order != NULL && order->
IsType(OT_CONDITIONAL)) {
1163 if (this->goto_type == OPOS_CONDITIONAL) {
1191 this->selected_order = -1;
1192 }
else if (sel == this->selected_order) {
1194 DoCommandP(this->vehicle->
tile, this->vehicle->index + (sel << 20),
1195 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
1200 this->selected_order = sel;
1208 this->UpdateButtonState();
1225 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1230 o->
IsType(OT_GOTO_STATION) ? 0 : (o->
IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1235 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1236 if (this->goto_type != OPOS_NONE) {
1243 switch (this->goto_type) {
1244 case OPOS_NONE: sel = -1;
break;
1245 case OPOS_GOTO: sel = 0;
break;
1246 case OPOS_CONDITIONAL: sel = 2;
break;
1247 case OPOS_SHARE: sel = 3;
break;
1248 default: NOT_REACHED();
1255 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1263 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1275 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1283 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1319 ShowVehicleListWindow(this->vehicle);
1328 uint value = atoi(str);
1337 value =
Clamp(value, 0, 100);
1368 default: NOT_REACHED();
1399 this->selected_order = -1;
1400 this->UpdateButtonState();
1446 if (this->goto_type == OPOS_GOTO) {
1448 if (cmd.
IsType(OT_NOTHING))
return;
1457 virtual bool OnVehicleSelect(
const Vehicle *v)
1464 bool share_order =
_ctrl_pressed || this->goto_type == OPOS_SHARE;
1465 if (this->vehicle->
GetNumOrders() != 0 && !share_order)
return false;
1467 if (
DoCommandP(this->vehicle->
tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->
index,
1469 this->selected_order = -1;
1477 this->goto_type = OPOS_NONE;
1497 this->order_over = to_order;
1516 static Hotkey order_hotkeys[] = {
1517 Hotkey(
'D',
"skip", OHK_SKIP),
1518 Hotkey(
'F',
"delete", OHK_DELETE),
1519 Hotkey(
'G',
"goto", OHK_GOTO),
1520 Hotkey(
'H',
"nonstop", OHK_NONSTOP),
1521 Hotkey(
'J',
"fullload", OHK_FULLLOAD),
1522 Hotkey(
'K',
"unload", OHK_UNLOAD),
1523 Hotkey((uint16)0,
"nearest_depot", OHK_NEAREST_DEPOT),
1524 Hotkey((uint16)0,
"always_service", OHK_ALWAYS_SERVICE),
1525 Hotkey((uint16)0,
"transfer", OHK_TRANSFER),
1526 Hotkey((uint16)0,
"no_unload", OHK_NO_UNLOAD),
1527 Hotkey((uint16)0,
"no_load", OHK_NO_LOAD),
1530 HotkeyList OrdersWindow::hotkeys(
"order", order_hotkeys);
1543 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(),
1593 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1603 WDP_AUTO,
"view_vehicle_orders_train", 384, 100,
1606 _nested_orders_train_widgets,
lengthof(_nested_orders_train_widgets),
1607 &OrdersWindow::hotkeys
1621 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(),
1667 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1676 WDP_AUTO,
"view_vehicle_orders", 384, 100,
1679 _nested_orders_widgets,
lengthof(_nested_orders_widgets),
1680 &OrdersWindow::hotkeys
1694 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(),
1703 WDP_AUTO,
"view_vehicle_orders_competitor", 384, 86,
1706 _nested_other_orders_widgets,
lengthof(_nested_other_orders_widgets),
1707 &OrdersWindow::hotkeys
1710 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.
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.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Automatically choose cargo type when doing auto refitting.
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?
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
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 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.
virtual void OnDragDrop(Point pt, int widget)
A dragged 'object' has been released.
static const VehicleOrderID INVALID_VEH_ORDER_ID
Invalid vehicle order index (sentinel)
Offset at top to draw the frame rectangular area.
Other order modifications.
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 ShowDropDownList(Window *w, const DropDownList *list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
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.
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.
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).
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.
int HideDropDownMenu(Window *pw)
Delete the drop-down menu from window pw.
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.
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int conditional_depth)
Get the distance between two orders of a vehicle.
T * Append(uint to_add=1)
Append an item and return it.
Order * next
Pointer to next order. If NULL, end of list.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Force the alignment, i.e. don't swap for RTL languages.
bool IsAutoRefit() const
Is this order a auto-refit order.
Functions related to (drawing on) viewports.
virtual void OnDropdownSelect(int widget, int index)
A dropdown option associated to this window has been selected.
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.
virtual void OnResize()
Called after the window got resized.
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.
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.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
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.
Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
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.
Simple vector template class, with automatic delete.
Station with truck stops.
ClientSettings _settings_client
The current settings for this game.
Definition of base types and functions in a cross-platform compatible way.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
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?
virtual void OnMouseDrag(Point pt, int widget)
An 'object' is being dragged at the provided position, highlight the target if possible.
TileIndex tile
Current tile index.
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Display 'stop sharing' in the middle button of the bottom row of the vehicle order window...
The tile has no ownership.
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...
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Basic functions/variables used all over the place.
Service the vehicle and then halt it.
StationFacilityByte facilities
The facilities that this station has.
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.
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.
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)
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
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.
OwnerByte owner
The owner of this station.
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...
bool IsBus() const
Check whether a roadvehicle is a bus.
Passes an OrderNonStopFlags.
Automatic refitting is allowed.
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
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.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
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
OwnerByte owner
Which company owns the vehicle?
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.
Skip based on the amount of load.
change the refit information of an order (for "goto depot" )
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...
Station with train station.
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.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Vehicle details; Window numbers:
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.
Order * GetOrder(int index) const
Returns order 'index' of a vehicle or NULL 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)
virtual void OnPaint()
The window must be repainted.
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.
uint32 Pack() const
Pack this order into a 32 bits integer, or actually only the type, flags and destination.
#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.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Functions related to tile highlights.
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 Station * Get(size_t index)
Gets station with given index.
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.
This depot order is because of the servicing limit.
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
VehicleTypeByte type
Type of vehicle.
Skip if the variable is false.
Dimensions (a width and height) of a rectangle in 2D.
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.
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
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.
AutoDeleteSmallVector< const DropDownListItem *, 4 > DropDownList
A drop down list is a collection of drop down list items.
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.