47 STR_ORDER_FULL_LOAD_ANY,
52 STR_ORDER_UNLOAD_FULL_LOAD,
53 STR_ORDER_UNLOAD_FULL_LOAD_ANY,
54 STR_ORDER_UNLOAD_NO_LOAD,
58 STR_ORDER_TRANSFER_FULL_LOAD,
59 STR_ORDER_TRANSFER_FULL_LOAD_ANY,
60 STR_ORDER_TRANSFER_NO_LOAD,
70 STR_ORDER_NO_UNLOAD_FULL_LOAD,
71 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
72 STR_ORDER_NO_UNLOAD_NO_LOAD,
79 STR_ORDER_FULL_LOAD_REFIT,
80 STR_ORDER_FULL_LOAD_ANY_REFIT,
83 STR_ORDER_UNLOAD_REFIT,
85 STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
86 STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
89 STR_ORDER_TRANSFER_REFIT,
91 STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
92 STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
101 STR_ORDER_NO_UNLOAD_REFIT,
103 STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
104 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
110 static const StringID _order_non_stop_drowdown[] = {
112 STR_ORDER_GO_NON_STOP_TO,
114 STR_ORDER_GO_NON_STOP_VIA,
118 static const StringID _order_full_load_drowdown[] = {
119 STR_ORDER_DROP_LOAD_IF_POSSIBLE,
121 STR_ORDER_DROP_FULL_LOAD_ALL,
122 STR_ORDER_DROP_FULL_LOAD_ANY,
123 STR_ORDER_DROP_NO_LOADING,
127 static const StringID _order_unload_drowdown[] = {
128 STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
129 STR_ORDER_DROP_UNLOAD,
130 STR_ORDER_DROP_TRANSFER,
132 STR_ORDER_DROP_NO_UNLOADING,
136 static const StringID _order_goto_dropdown[] = {
138 STR_ORDER_GO_TO_NEAREST_DEPOT,
139 STR_ORDER_CONDITIONAL,
144 static const StringID _order_goto_dropdown_aircraft[] = {
146 STR_ORDER_GO_TO_NEAREST_HANGAR,
147 STR_ORDER_CONDITIONAL,
164 static const StringID _order_conditional_condition[] = {
165 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
166 STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
167 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
168 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
169 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
170 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
171 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
172 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
179 static const StringID _order_depot_action_dropdown[] = {
180 STR_ORDER_DROP_GO_ALWAYS_DEPOT,
181 STR_ORDER_DROP_SERVICE_DEPOT,
182 STR_ORDER_DROP_HALT_DEPOT,
186 static int DepotActionStringIndex(
const Order *order)
197 static const StringID _order_refit_action_dropdown[] = {
198 STR_ORDER_DROP_REFIT_AUTO,
199 STR_ORDER_DROP_REFIT_AUTO_ANY,
215 void DrawOrderString(
const Vehicle *v,
const Order *order,
int order_index,
int y,
bool selected,
bool timetable,
int left,
int middle,
int right)
219 SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
223 DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((
int)
FONT_HEIGHT_NORMAL - (
int)sprite_size.height) / 2);
229 if (order->
IsType(OT_IMPLICIT)) {
230 colour = (selected ? TC_SILVER : TC_GREY) |
TC_NO_SHADE;
231 }
else if (selected) {
257 SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
260 case OT_GOTO_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);
536 int num = this->selected_order;
537 return (num >= 0 && num < vehicle->GetNumOrders()) ? num : vehicle->
GetNumOrders();
565 assert(type > OPOS_NONE && type < OPOS_END);
573 this->goto_type = type;
586 if (order == NULL || order->
GetLoadType() == load_type)
return;
611 if (order == NULL)
return;
640 if (order == NULL || order->
GetUnloadType() == unload_type)
return;
642 if (unload_type < 0) {
713 int selected = this->selected_order + (int)
_networking;
716 this->selected_order = selected >= this->vehicle->
GetNumOrders() ? -1 : selected;
717 this->UpdateButtonState();
741 this->UpdateButtonState();
768 this->can_do_refit =
false;
769 this->can_do_autorefit =
false;
788 this->selected_order = -1;
790 this->goto_type = OPOS_NONE;
797 int station_orders = 0;
799 FOR_VEHICLE_ORDERS(v, order) {
800 if (order->
IsType(OT_GOTO_STATION)) station_orders++;
821 d.width += padding.width;
822 d.height += padding.height;
832 d.width += padding.width;
833 d.height += padding.height;
863 if (this->selected_order == -1)
break;
867 this->selected_order = -1;
877 if (gui_scope)
break;
878 from =
GB(data, 0, 8);
882 if (this->selected_order == -1)
break;
884 if (from == to)
break;
886 if (from != this->selected_order) {
888 this->selected_order -= (int)(from <= this->selected_order);
890 this->selected_order += (int)(to <= this->selected_order);
899 this->selected_order = -1;
904 this->selected_order = to;
909 if (gui_scope) this->UpdateButtonState();
917 void UpdateButtonState()
931 if (shared_orders && this->selected_order == this->vehicle->
GetNumOrders()) {
938 (uint)this->vehicle->
GetNumOrders() + ((shared_orders || this->vehicle->
GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order);
943 if (this->selected_order == this->vehicle->
GetNumOrders()) {
944 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
946 nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
963 assert(row_sel != NULL || (train_row_sel != NULL && left_sel != NULL && middle_sel != NULL && right_sel != NULL));
967 if (row_sel != NULL) {
985 case OT_GOTO_STATION:
986 if (row_sel != NULL) {
1003 ((!this->can_do_refit || !this->can_do_autorefit) && !order->
IsRefit()));
1007 case OT_GOTO_WAYPOINT:
1008 if (row_sel != NULL) {
1024 if (row_sel != NULL) {
1038 (!this->can_do_refit && !order->
IsRefit()));
1042 case OT_CONDITIONAL: {
1043 if (row_sel != NULL) {
1050 this->GetWidget<NWidgetCore>(
WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
1058 if (row_sel != NULL) {
1083 this->selected_order = -1;
1100 int line_height = this->GetWidget<NWidgetBase>(
WID_O_ORDER_LIST)->resize_y;
1106 while (order != NULL) {
1108 if (!this->vscroll->
IsVisible(i))
break;
1110 if (i != this->selected_order && i == this->order_over) {
1112 int top = (this->order_over < this->selected_order ? y : y + line_height) -
WD_FRAMERECT_TOP;
1121 order = order->
next;
1127 order = this->vehicle->
GetOrder(i);
1131 while (order != NULL) {
1133 if (!this->vscroll->
IsVisible(i))
break;
1139 order = order->
next;
1155 if (order != NULL && order->
IsType(OT_CONDITIONAL)) {
1173 if (this->goto_type == OPOS_CONDITIONAL) {
1201 this->selected_order = -1;
1202 }
else if (sel == this->selected_order) {
1204 DoCommandP(this->vehicle->
tile, this->vehicle->index + (sel << 20),
1205 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
1210 this->selected_order = sel;
1218 this->UpdateButtonState();
1235 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1240 o->
IsType(OT_GOTO_STATION) ? 0 : (o->
IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1245 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1246 if (this->goto_type != OPOS_NONE) {
1253 switch (this->goto_type) {
1254 case OPOS_NONE: sel = -1;
break;
1255 case OPOS_GOTO: sel = 0;
break;
1256 case OPOS_CONDITIONAL: sel = 2;
break;
1257 case OPOS_SHARE: sel = 3;
break;
1258 default: NOT_REACHED();
1265 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1273 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1285 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1293 if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1329 ShowVehicleListWindow(this->vehicle);
1338 uint value = atoi(str);
1347 value =
Clamp(value, 0, 100);
1378 default: NOT_REACHED();
1409 this->selected_order = -1;
1410 this->UpdateButtonState();
1456 if (this->goto_type == OPOS_GOTO) {
1458 if (cmd.
IsType(OT_NOTHING))
return;
1467 virtual bool OnVehicleSelect(
const Vehicle *v)
1474 bool share_order =
_ctrl_pressed || this->goto_type == OPOS_SHARE;
1475 if (this->vehicle->
GetNumOrders() != 0 && !share_order)
return false;
1477 if (
DoCommandP(this->vehicle->
tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->
index,
1479 this->selected_order = -1;
1487 this->goto_type = OPOS_NONE;
1507 this->order_over = to_order;
1526 static Hotkey order_hotkeys[] = {
1527 Hotkey(
'D',
"skip", OHK_SKIP),
1528 Hotkey(
'F',
"delete", OHK_DELETE),
1529 Hotkey(
'G',
"goto", OHK_GOTO),
1530 Hotkey(
'H',
"nonstop", OHK_NONSTOP),
1531 Hotkey(
'J',
"fullload", OHK_FULLLOAD),
1532 Hotkey(
'K',
"unload", OHK_UNLOAD),
1533 Hotkey((uint16)0,
"nearest_depot", OHK_NEAREST_DEPOT),
1534 Hotkey((uint16)0,
"always_service", OHK_ALWAYS_SERVICE),
1535 Hotkey((uint16)0,
"transfer", OHK_TRANSFER),
1536 Hotkey((uint16)0,
"no_unload", OHK_NO_UNLOAD),
1537 Hotkey((uint16)0,
"no_load", OHK_NO_LOAD),
1540 HotkeyList OrdersWindow::hotkeys(
"order", order_hotkeys);
1553 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(),
1603 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1613 WDP_AUTO,
"view_vehicle_orders_train", 384, 100,
1616 _nested_orders_train_widgets,
lengthof(_nested_orders_train_widgets),
1617 &OrdersWindow::hotkeys
1631 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(),
1677 SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP),
SetResize(1, 0),
1686 WDP_AUTO,
"view_vehicle_orders", 384, 100,
1689 _nested_orders_widgets,
lengthof(_nested_orders_widgets),
1690 &OrdersWindow::hotkeys
1704 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(),
1713 WDP_AUTO,
"view_vehicle_orders_competitor", 384, 86,
1716 _nested_other_orders_widgets,
lengthof(_nested_other_orders_widgets),
1717 &OrdersWindow::hotkeys
1720 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...
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.
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).
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.
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.
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 given 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.
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.
TileArea location
Location of the industry.
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.
TileIndex tile
The base tile of the area.
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.
TileIndex xy
Base tile of the station.
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" )
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...
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.
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.
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.
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.
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.
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.