OpenTTD Source: Order Struct Reference

OpenTTD Source 15.3

Public Member Functions | Private Attributes | Friends
Order Struct Reference

## Public Member Functions
| Order (uint8_t type, uint8_t flags, DestinationID dest)
bool | IsType (OrderType type) const
| Check whether this order is of the given type.
OrderType | GetType () const
| Get the type of order of this order.
void | Free ()
| 'Free' the order
void | MakeGoToStation (StationID destination)
| Makes this order a Go To Station order.
void | MakeGoToDepot (DestinationID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type=OrderNonStopFlag::NoIntermediate, OrderDepotActionFlags action={}, CargoType cargo=CARGO_NO_REFIT)
| Makes this order a Go To Depot order.
void | MakeGoToWaypoint (StationID destination)
| Makes this order a Go To Waypoint order.
void | MakeLoading (bool ordered)
| Makes this order a Loading order.
void | MakeLeaveStation ()
| Makes this order a Leave Station order.
void | MakeDummy ()
| Makes this order a Dummy order.
void | MakeConditional (VehicleOrderID order)
| Makes this order an conditional order.
void | MakeImplicit (StationID destination)
| Makes this order an implicit order.
bool | IsGotoOrder () const
| Is this a 'goto' order with a real destination?
DestinationID | GetDestination () const
| Gets the destination of this order.
void | SetDestination (DestinationID destination)
| Sets the destination of this order.
bool | IsRefit () const
| Is this order a refit order.
bool | IsAutoRefit () const
| Is this order a auto-refit order.
CargoType | GetRefitCargo () const
| Get the cargo to to refit to.
void | SetRefit (CargoType cargo)
| Make this depot/station order also a refit order.
bool | IsFullLoadOrder () const
| Is this order a OrderLoadType::FullLoad or OrderLoadType::FullLoadAny?
OrderLoadType | GetLoadType () const
| How must the consist be loaded?
OrderUnloadType | GetUnloadType () const
| How must the consist be unloaded?
OrderNonStopFlags | GetNonStopType () const
| At which stations must we stop?
OrderStopLocation | GetStopLocation () const
| Where must we stop at the platform?
OrderDepotTypeFlags | GetDepotOrderType () const
| What caused us going to the depot?
OrderDepotActionFlags | GetDepotActionType () const
| What are we going to do when in the depot.
OrderConditionVariable | GetConditionVariable () const
| What variable do we have to compare?
OrderConditionComparator | GetConditionComparator () const
| What is the comparator to use?
VehicleOrderID | GetConditionSkipToOrder () const
| Get the order to skip to.
uint16_t | GetConditionValue () const
| Get the value to base the skip on.
void | SetLoadType (OrderLoadType load_type)
| Set how the consist must be loaded.
void | SetUnloadType (OrderUnloadType unload_type)
| Set how the consist must be unloaded.
void | SetNonStopType (OrderNonStopFlags non_stop_type)
| Set whether we must stop at stations or not.
void | SetStopLocation (OrderStopLocation stop_location)
| Set where we must stop at the platform.
void | SetDepotOrderType (OrderDepotTypeFlags depot_order_type)
| Set the cause to go to the depot.
void | SetDepotActionType (OrderDepotActionFlags depot_service_type)
| Set what we are going to do in the depot.
void | SetConditionVariable (OrderConditionVariable condition_variable)
| Set variable we have to compare.
void | SetConditionComparator (OrderConditionComparator condition_comparator)
| Set the comparator to use.
void | SetConditionSkipToOrder (VehicleOrderID order_id)
| Get the order to skip to.
void | SetConditionValue (uint16_t value)
| Set the value to base the skip on.
bool | IsWaitTimetabled () const
| Does this order have an explicit wait time set?
bool | IsTravelTimetabled () const
| Does this order have an explicit travel time set?
uint16_t | GetTimetabledWait () const
| Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled.
uint16_t | GetTimetabledTravel () const
| Get the time in ticks a vehicle should take to reach the destination or 0 if it's not timetabled.
uint16_t | GetWaitTime () const
| Get the time in ticks a vehicle will probably wait at the destination (timetabled or not).
uint16_t | GetTravelTime () const
| Get the time in ticks a vehicle will probably take to reach the destination (timetabled or not).
uint16_t | GetMaxSpeed () const
| Get the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.
void | SetWaitTimetabled (bool timetabled)
| Set if the wait time is explicitly timetabled (unless the order is conditional).
void | SetTravelTimetabled (bool timetabled)
| Set if the travel time is explicitly timetabled (unless the order is conditional).
void | SetWaitTime (uint16_t time)
| Set the time in ticks to wait at the destination.
void | SetTravelTime (uint16_t time)
| Set the time in ticks to take for travelling to the destination.
void | SetMaxSpeed (uint16_t speed)
| Set the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.
bool | ShouldStopAtStation (const Vehicle *v, StationID station) const
| Check whether the given vehicle should stop at the given station based on this order and the non-stop settings.
bool | CanLoadOrUnload () const
bool | CanLeaveWithCargo (bool has_cargo) const
| A vehicle can leave the current station with cargo if:
TileIndex | GetLocation (const Vehicle *v, bool airport=false) const
| Returns a tile somewhat representing the order destination (not suitable for pathfinding).
bool | IsCompletelyTimetabled () const
| Checks if travel_time and wait_time apply to this order and if they are timetabled.
void | AssignOrder (const Order &other)
| Assign data to an order (from another order) This function makes sure that the index is maintained correctly.
bool | Equals (const Order &other) const
| Does this order have the same type, flags and destination?
uint16_t | MapOldOrder () const
| Pack this order into a 16 bits integer as close to the TTD representation as possible.
void | ConvertFromOldSavegame ()
| Converts this order from an old savegame's version; it moves all bits to the new location.

## Private Attributes
uint8_t | type = 0
| The type of order + non-stop flags.
uint8_t | flags = 0
| Load/unload types, depot order/action types.
DestinationID | dest {}
| The destination of the order.
CargoType | refit_cargo = CARGO_NO_REFIT
| Refit CargoType.
uint16_t | wait_time = 0
| How long in ticks to wait at the destination.
uint16_t | travel_time = 0
| How long in ticks the journey to this destination should take.
uint16_t | max_speed = UINT16_MAX
| How fast the vehicle may go on the way to the destination.

## Friends
struct | VEHSChunkHandler
| Loading of ancient vehicles.
class | SlVehicleCommon
class | SlVehicleDisaster
template<typename T >
class | SlOrders
SaveLoadTable | GetOrderDescription ()
| Saving and loading of orders.
template<typename Tcont , typename Titer >
EndianBufferWriter< Tcont, Titer > & | operator<< (EndianBufferWriter< Tcont, Titer > &buffer, const Order &data)
class EndianBufferReader & | operator>> (class EndianBufferReader &buffer, Order &order)

## Detailed Description

Definition at line 33 of file order_base.h.

## Constructor & Destructor Documentation

## ◆ Order() [1/2]

Order::Order | ( |  | ) |
| inline

Definition at line 58 of file order_base.h.

## ◆ Order() [2/2]

Order::Order | ( | uint8_t | type,
|  | uint8_t | flags,
|  | DestinationID | dest
| ) |  |
| inline

Definition at line 59 of file order_base.h.

## Member Function Documentation

## ◆ AssignOrder()

void Order::AssignOrder | ( | const Order & | other | ) |

Assign data to an order (from another order) This function makes sure that the index is maintained correctly.

Parameters

  other | the data to copy (except next pointer).

Definition at line 235 of file order_cmd.cpp.

References dest, flags, max_speed, refit_cargo, travel_time, type, and wait_time.

## ◆ CanLeaveWithCargo()

bool Order::CanLeaveWithCargo | ( | bool | has_cargo | ) | const

A vehicle can leave the current station with cargo if:

1. it can load cargo here OR 2a. it could leave the last station with cargo AND 2b. it doesn't have to unload all cargo here.

Definition at line 2200 of file order_cmd.cpp.

References GetLoadType(), GetUnloadType(), NoLoad, Transfer, and Unload.

Referenced by LinkRefresher::RefreshLinks().

## ◆ CanLoadOrUnload()

bool Order::CanLoadOrUnload | ( |  | ) | const

Definition at line 2186 of file order_cmd.cpp.

## ◆ ConvertFromOldSavegame()

void Order::ConvertFromOldSavegame | ( |  | ) |

Converts this order from an old savegame's version; it moves all bits to the new location.

Definition at line 26 of file order_sl.cpp.

References _savegame_type, _settings_client, FarEnd, flags, FullLoad, FullLoadAny, GetType(), ClientSettings::gui, Halt, IsSavegameVersionBefore(), IsType(), LoadIfPossible, GUISettings::new_nonstop, NoDestination, NoIntermediate, NoLoad, PartOfOrders, Service, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SetDepotActionType(), SetDepotOrderType(), SetLoadType(), SetNonStopType(), SetStopLocation(), SetUnloadType(), GUISettings::sg_full_load_any, GUISettings::sg_new_nonstop, SGT_TTD, SGT_TTO, SLV_22, Transfer, Unload, and UnloadIfPossible.

## ◆ Equals()

bool Order::Equals | ( | const Order & | other | ) | const

Does this order have the same type, flags and destination?

Parameters

  other | the second order to compare to.

Returns
  true if the type, flags and destination match.

Definition at line 158 of file order_cmd.cpp.

References dest, flags, GetDepotActionType(), GetDepotOrderType(), IsType(), NearestDepot, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and type.

Referenced by ChangeTimetable(), and ProcessOrders().

## ◆ Free()

void Order::Free | ( |  | ) |

'Free' the order

Note
  ONLY use on "current_order" vehicle orders!

Definition at line 47 of file order_cmd.cpp.

Referenced by AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), GetOrderCmdFromTile(), ProcessOrders(), and UpdateOrderDest().

## ◆ GetConditionComparator()

OrderConditionComparator Order::GetConditionComparator | ( |  | ) | const
| inline

What is the comparator to use?

Definition at line 156 of file order_base.h.

References GB().

Referenced by CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), OrdersWindow::OnClick(), and ProcessConditionalOrder().

## ◆ GetConditionSkipToOrder()

VehicleOrderID Order::GetConditionSkipToOrder | ( |  | ) | const
| inline

Get the order to skip to.

Definition at line 158 of file order_base.h.

References flags.

Referenced by CmdInsertOrder(), DrawOrderString(), OrderList::GetNextDecisionNode(), and ProcessConditionalOrder().

## ◆ GetConditionValue()

uint16_t Order::GetConditionValue | ( |  | ) | const
| inline

Get the value to base the skip on.

Definition at line 160 of file order_base.h.

References dest, and GB().

Referenced by CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), OrdersWindow::GetWidgetString(), OrdersWindow::OnClick(), and ProcessConditionalOrder().

## ◆ GetConditionVariable()

OrderConditionVariable Order::GetConditionVariable | ( |  | ) | const
| inline

What variable do we have to compare?

Definition at line 154 of file order_base.h.

References dest, and GB().

Referenced by CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), OrderList::GetNextDecisionNode(), OrdersWindow::GetWidgetString(), OrdersWindow::OnClick(), OrdersWindow::OnQueryTextFinished(), and ProcessConditionalOrder().

## ◆ GetDepotActionType()

OrderDepotActionFlags Order::GetDepotActionType | ( |  | ) | const
| inline

What are we going to do when in the depot.

Definition at line 152 of file order_base.h.

References GB().

Referenced by CmdInsertOrder(), CmdModifyOrder(), CmdOrderRefit(), DrawOrderString(), Equals(), FindNearestHangar(), OrderList::GetNextDecisionNode(), OrdersWindow::GetWidgetString(), Vehicle::HasUnbunchingOrder(), PreviousOrderIsUnbunching(), RemoveOrderFromAllVehicles(), UpdateOrderDest(), and VehicleEnterDepot().

## ◆ GetDepotOrderType()

OrderDepotTypeFlags Order::GetDepotOrderType | ( |  | ) | const
| inline

What caused us going to the depot?

Definition at line 150 of file order_base.h.

References GB().

Referenced by CmdInsertOrder(), CmdModifyOrder(), CmdOrderRefit(), Equals(), OrdersWindow::GetWidgetString(), MapOldOrder(), OrdersWindow::OrderClick_Service(), ProcessOrders(), ShouldStopAtStation(), VehicleOrderSaver::SwitchToNextOrder(), UpdateAirplanesOnNewStation(), UpdateOrderDest(), and VehicleEnterDepot().

## ◆ GetDestination()

DestinationID Order::GetDestination | ( |  | ) | const
| inline

Gets the destination of this order.

Precondition
  IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).

Returns
  the destination of the order.

Definition at line 99 of file order_base.h.

References dest.

Referenced by AircraftController(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), AircraftNextAirportPos_and_Order(), Vehicle::BeginLoading(), CheckIfTrainNeedsService(), CheckNextTrainTile(), CheckShipStayInDepot(), CmdInsertOrder(), DrawOrderString(), FindNearestHangar(), GetLocation(), GetTrainStopLocation(), Vehicle::HandleLoading(), MapOldOrder(), Train::OnNewEconomyDay(), OrderGoesToStation(), CYapfCostRailT< Types >::PfCalcCost(), ProcessOrders(), RemoveOrderFromAllVehicles(), UpdateAirplanesOnNewStation(), UpdateOrderDest(), UpdateWaypointOrder(), UpdateWaypointOrder(), and VehicleEnterDepot().

## ◆ GetLoadType()

OrderLoadType Order::GetLoadType | ( |  | ) | const
| inline

How must the consist be loaded?

Definition at line 142 of file order_base.h.

References GB().

Referenced by CalcPercentVehicleFilled(), CanLeaveWithCargo(), CmdInsertOrder(), CmdModifyOrder(), CmdOrderRefit(), DrawOrderString(), IsFullLoadOrder(), LoadUnloadVehicle(), MapOldOrder(), OrdersWindow::OnClick(), OrdersWindow::OrderClick_FullLoad(), and VehicleResolverObject::ResolveReal().

## ◆ GetLocation()

TileIndex Order::GetLocation | ( | const Vehicle * | v,
|  | bool | airport = `false`
| ) |  | const

Returns a tile somewhat representing the order destination (not suitable for pathfinding).

Parameters

  v | The vehicle to get the location for.
  airport | Get the airport tile and not the station location for aircraft.

Returns
  destination of order, or INVALID_TILE if none.

Definition at line 562 of file order_cmd.cpp.

References Station::airport, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_station_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_depot_pool >::Get(), GetDestination(), GetType(), INVALID_TILE, OrthogonalTileArea::tile, BaseVehicle::type, VEH_AIRCRAFT, and BaseStation::xy.

Referenced by OrdersWindow::OnClick(), VehicleViewWindow::OnClick(), and VehicleViewWindow::OnPaint().

## ◆ GetMaxSpeed()

uint16_t Order::GetMaxSpeed | ( |  | ) | const
| inline

Get the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.

Returns
  maximum speed.

Definition at line 207 of file order_base.h.

References max_speed.

Referenced by CmdChangeTimetable(), CmdInsertOrder(), RoadVehicle::GetCurrentMaxSpeed(), Train::GetCurrentMaxSpeed(), TimetableWindow::OnClick(), CYapfCostRoadT< Types >::PfCalcCost(), CYapfCostRailT< Types >::PfCalcCost(), and ShipAccelerate().

## ◆ GetNonStopType()

OrderNonStopFlags Order::GetNonStopType | ( |  | ) | const
| inline

At which stations must we stop?

Definition at line 146 of file order_base.h.

References GB().

Referenced by TimetableWindow::BuildArrivalDepartureList(), CanDetermineTimeTaken(), CmdChangeTimetable(), CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), IsCompletelyTimetabled(), MapOldOrder(), OrdersWindow::OnClick(), TimetableWindow::OnPaint(), OrdersWindow::OrderClick_Nonstop(), ProcessOrders(), ShouldStopAtStation(), and VehicleTimetableSorter().

## ◆ GetRefitCargo()

CargoType Order::GetRefitCargo | ( |  | ) | const
| inline

Get the cargo to to refit to.

Precondition
  IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)

Returns
  the cargo type.

Definition at line 127 of file order_base.h.

References refit_cargo.

Referenced by CmdInsertOrder(), DrawOrderString(), GetIncompatibleRefitOrderIdForAutoreplace(), LoadUnloadVehicle(), LinkRefresher::RefreshLinks(), ReserveConsist(), and VehicleEnterDepot().

## ◆ GetStopLocation()

OrderStopLocation Order::GetStopLocation | ( |  | ) | const
| inline

Where must we stop at the platform?

Definition at line 148 of file order_base.h.

References GB().

Referenced by CmdInsertOrder(), DrawOrderString(), GetTrainStopLocation(), and OrdersWindow::OnClick().

## ◆ GetTimetabledTravel()

uint16_t Order::GetTimetabledTravel | ( |  | ) | const
| inline

Get the time in ticks a vehicle should take to reach the destination or 0 if it's not timetabled.

Definition at line 196 of file order_base.h.

References IsTravelTimetabled(), and travel_time.

Referenced by ChangeTimetable(), UpdateOrderDest(), and UpdateVehicleTimetable().

## ◆ GetTimetabledWait()

uint16_t Order::GetTimetabledWait | ( |  | ) | const
| inline

Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled.

Definition at line 194 of file order_base.h.

References IsWaitTimetabled(), and wait_time.

Referenced by ChangeTimetable(), LoadUnloadVehicle(), RemoveOrderFromAllVehicles(), and UpdateVehicleTimetable().

## ◆ GetTravelTime()

uint16_t Order::GetTravelTime | ( |  | ) | const
| inline

Get the time in ticks a vehicle will probably take to reach the destination (timetabled or not).

Definition at line 200 of file order_base.h.

References travel_time.

Referenced by ChangeTimetable(), CmdChangeTimetable(), CmdInsertOrder(), and TimetableWindow::OnClick().

## ◆ GetType()

OrderType Order::GetType | ( |  | ) | const
| inline

Get the type of order of this order.

Returns
  the order type.

Definition at line 72 of file order_base.h.

References GB().

Referenced by AircraftEventHandler_AtTerminal(), CheckNextTrainTile(), CmdChangeTimetable(), CmdInsertOrder(), CmdModifyOrder(), ConvertFromOldSavegame(), DrawOrderString(), GetLocation(), IsType(), MapOldOrder(), ProcessConditionalOrder(), ProcessOrders(), RemoveOrderFromAllVehicles(), ReverseTrainDirection(), VehicleOrderSaver::SwitchToNextOrder(), and UpdateOrderDest().

## ◆ GetUnloadType()

OrderUnloadType Order::GetUnloadType | ( |  | ) | const
| inline

How must the consist be unloaded?

Definition at line 144 of file order_base.h.

References GB().

Referenced by CanLeaveWithCargo(), CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), LoadUnloadVehicle(), MapOldOrder(), OrdersWindow::OnClick(), OrdersWindow::OrderClick_Unload(), PrepareUnload(), and VehicleResolverObject::ResolveReal().

## ◆ GetWaitTime()

uint16_t Order::GetWaitTime | ( |  | ) | const
| inline

Get the time in ticks a vehicle will probably wait at the destination (timetabled or not).

Definition at line 198 of file order_base.h.

References wait_time.

Referenced by ChangeTimetable(), CmdChangeTimetable(), CmdInsertOrder(), DrawOrderString(), TimetableWindow::OnClick(), RemoveOrderFromAllVehicles(), and UpdateVehicleTimetable().

## ◆ IsAutoRefit()

bool Order::IsAutoRefit | ( |  | ) | const
| inline

Is this order a auto-refit order.

Precondition
  IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)

Returns
  true if a auto-refit should happen.

Definition at line 120 of file order_base.h.

References CARGO_AUTO_REFIT.

Referenced by DrawOrderString(), and LinkRefresher::RefreshLinks().

## ◆ IsCompletelyTimetabled()

bool Order::IsCompletelyTimetabled | ( |  | ) | const
| inline

Checks if travel_time and wait_time apply to this order and if they are timetabled.

Definition at line 240 of file order_base.h.

References GetNonStopType(), IsTravelTimetabled(), IsType(), IsWaitTimetabled(), and NoDestination.

## ◆ IsFullLoadOrder()

bool Order::IsFullLoadOrder | ( |  | ) | const
| inline

Is this order a OrderLoadType::FullLoad or OrderLoadType::FullLoadAny?

Returns
  true iff the order is a full load or full load any order.

Definition at line 135 of file order_base.h.

References FullLoad, FullLoadAny, GetLoadType(), and type.

Referenced by CalcPercentVehicleFilled(), CancelLoadingDueToDeletedOrder(), HandleStationRefit(), Vehicle::HasFullLoadOrder(), LoadUnloadVehicle(), and MapOldOrder().

## ◆ IsGotoOrder()

bool Order::IsGotoOrder | ( |  | ) | const
| inline

Is this a 'goto' order with a real destination?

Returns
  True if the type is either OT_GOTO_WAYPOINT, OT_GOTO_DEPOT or OT_GOTO_STATION.

Definition at line 89 of file order_base.h.

References IsType().

Referenced by DrawOrderString().

## ◆ IsRefit()

bool Order::IsRefit | ( |  | ) | const
| inline

Is this order a refit order.

Precondition
  IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)

Returns
  true if a refit should happen.

Definition at line 113 of file order_base.h.

References CARGO_AUTO_REFIT, and NUM_CARGO.

Referenced by DrawOrderString(), GetIncompatibleRefitOrderIdForAutoreplace(), OrderList::GetNextDecisionNode(), LoadUnloadVehicle(), LinkRefresher::RefreshLinks(), ReserveConsist(), and VehicleEnterDepot().

## ◆ IsTravelTimetabled()

bool Order::IsTravelTimetabled | ( |  | ) | const
| inline

Does this order have an explicit travel time set?

Definition at line 191 of file order_base.h.

References HasBit(), and IsType().

Referenced by CanDetermineTimeTaken(), CmdChangeTimetable(), GetTimetabledTravel(), IsCompletelyTimetabled(), RemoveOrderFromAllVehicles(), and UpdateVehicleTimetable().

## ◆ IsType()

bool Order::IsType | ( | OrderType | type | ) | const
| inline

Check whether this order is of the given type.

Parameters

  type | the type to check against.

Returns
  true if the order matches.

Definition at line 66 of file order_base.h.

References GetType(), and type.

Referenced by AfterLoadGame(), AircraftEntersTerminal(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), AircraftNextAirportPos_and_Order(), Vehicle::BeginLoading(), TimetableWindow::BuildArrivalDepartureList(), CalcPercentVehicleFilled(), CancelLoadingDueToDeletedOrder(), CanDetermineTimeTaken(), CheckIfTrainNeedsService(), CheckShipStayInDepot(), CheckTrainStayInDepot(), CmdBuildSingleSignal(), CmdBulkChangeTimetable(), CmdChangeTimetable(), CmdModifyOrder(), CmdOrderRefit(), CmdRefitVehicle(), CmdReverseTrainDirection(), CmdSkipToOrder(), CmdTurnRoadVeh(), ConvertFromOldSavegame(), DeleteOrder(), DeleteVehicleOrders(), DrawOrderString(), Equals(), FindNearestHangar(), OrderList::GetNextDecisionNode(), GetTrainStopLocation(), OrdersWindow::GetWidgetString(), Vehicle::HandleLoading(), Vehicle::HasConditionalOrder(), Vehicle::HasDepotOrder(), Vehicle::HasFullLoadOrder(), Vehicle::HasUnbunchingOrder(), IsCompletelyTimetabled(), IsGotoOrder(), IsTravelTimetabled(), IsWaitTimetabled(), LoadUnloadVehicle(), MapAircraftMovementAction(), Vehicle::NeedsAutomaticServicing(), OrdersWindow::OnClick(), Train::OnNewEconomyDay(), TimetableWindow::OnPaint(), OrdersWindow::OnPlaceObject(), OrderGoesToStation(), CYapfCostRailT< Types >::PfCalcCost(), PreviousOrderIsUnbunching(), ProcessOrders(), LinkRefresher::RefreshLinks(), RemoveOrderFromAllVehicles(), RemoveRoadStop(), VehicleResolverObject::ResolveReal(), SetTravelTimetabled(), SetWaitTimetabled(), ShouldStopAtStation(), UnpackOldOrder(), UpdateAirplanesOnNewStation(), UpdateOldAircraft(), UpdateOrderDest(), UpdateVehicleTimetable(), UpdateWaypointOrder(), UpdateWaypointOrder(), VehicleEnterDepot(), and VehicleTimetableSorter().

## ◆ IsWaitTimetabled()

bool Order::IsWaitTimetabled | ( |  | ) | const
| inline

Does this order have an explicit wait time set?

Definition at line 189 of file order_base.h.

References HasBit(), and IsType().

Referenced by CanDetermineTimeTaken(), CmdChangeTimetable(), DrawOrderString(), GetTimetabledWait(), IsCompletelyTimetabled(), RemoveOrderFromAllVehicles(), and UpdateVehicleTimetable().

## ◆ MakeConditional()

void Order::MakeConditional | ( | VehicleOrderID | order | ) |

Makes this order an conditional order.

Parameters

  order | the order to jump to.

Definition at line 126 of file order_cmd.cpp.

References dest, flags, and type.

Referenced by OrdersWindow::OnClick().

## ◆ MakeDummy()

void Order::MakeDummy | ( |  | ) |

Makes this order a Dummy order.

Definition at line 116 of file order_cmd.cpp.

References flags, and type.

Referenced by CheckIfTrainNeedsService(), RemoveOrderFromAllVehicles(), UnpackOldOrder(), UpdateAirplanesOnNewStation(), and VehicleEnterDepot().

## ◆ MakeGoToDepot()

void Order::MakeGoToDepot | ( | DestinationID | destination,
|  | OrderDepotTypeFlags | order,
|  | OrderNonStopFlags | non_stop_type = `OrderNonStopFlag::NoIntermediate`,
|  | OrderDepotActionFlags | action = `{}`,
|  | CargoType | cargo = `CARGO_NO_REFIT`
| ) |  |

Makes this order a Go To Depot order.

Parameters

  destination | the depot to go to.
  order | is this order a 'default' order, or an overridden vehicle order?
  non_stop_type | how to get to the depot?
  action | what to do in the depot?
  cargo | the cargo type to change to.

Definition at line 73 of file order_cmd.cpp.

References dest, SetDepotActionType(), SetDepotOrderType(), SetNonStopType(), SetRefit(), and type.

Referenced by CheckIfTrainNeedsService(), GetOrderCmdFromTile(), and OrdersWindow::OrderClick_NearestDepot().

## ◆ MakeGoToStation()

void Order::MakeGoToStation | ( | StationID | destination | ) |

Makes this order a Go To Station order.

Parameters

  destination | the station to go to.

Definition at line 58 of file order_cmd.cpp.

References dest, flags, and type.

Referenced by GetOrderCmdFromTile().

## ◆ MakeGoToWaypoint()

void Order::MakeGoToWaypoint | ( | StationID | destination | ) |

Makes this order a Go To Waypoint order.

Parameters

  destination | the waypoint to go to.

Definition at line 87 of file order_cmd.cpp.

References dest, flags, and type.

Referenced by GetOrderCmdFromTile(), and UpdateWaypointOrder().

## ◆ MakeImplicit()

void Order::MakeImplicit | ( | StationID | destination | ) |

Makes this order an implicit order.

Parameters

  destination | the station to go to.

Definition at line 137 of file order_cmd.cpp.

References dest, and type.

Referenced by Vehicle::BeginLoading().

## ◆ MakeLeaveStation()

void Order::MakeLeaveStation | ( |  | ) |

Makes this order a Leave Station order.

Definition at line 107 of file order_cmd.cpp.

References flags, and type.

## ◆ MakeLoading()

void Order::MakeLoading | ( | bool | ordered | ) |

Makes this order a Loading order.

Parameters

  ordered | is this an ordered stop?

Definition at line 98 of file order_cmd.cpp.

References flags, and type.

## ◆ MapOldOrder()

uint16_t Order::MapOldOrder | ( |  | ) | const

Pack this order into a 16 bits integer as close to the TTD representation as possible.

Returns
  the TTD-like packed representation.

Definition at line 180 of file order_cmd.cpp.

References GB(), GetDepotOrderType(), GetDestination(), GetLoadType(), GetNonStopType(), GetType(), GetUnloadType(), IsFullLoadOrder(), NoIntermediate, NoLoad, NoUnload, PartOfOrders, SetBit(), and Unload.

## ◆ SetConditionComparator()

void Order::SetConditionComparator | ( | OrderConditionComparator | condition_comparator | ) |
| inline

Set the comparator to use.

Definition at line 177 of file order_base.h.

References SB(), and to_underlying().

Referenced by CmdModifyOrder().

## ◆ SetConditionSkipToOrder()

void Order::SetConditionSkipToOrder | ( | VehicleOrderID | order_id | ) |
| inline

Get the order to skip to.

Definition at line 179 of file order_base.h.

Referenced by CmdModifyOrder().

## ◆ SetConditionValue()

void Order::SetConditionValue | ( | uint16_t | value | ) |
| inline

Set the value to base the skip on.

Definition at line 181 of file order_base.h.

References dest, and SB().

Referenced by CmdModifyOrder().

## ◆ SetConditionVariable()

void Order::SetConditionVariable | ( | OrderConditionVariable | condition_variable | ) |
| inline

Set variable we have to compare.

Definition at line 175 of file order_base.h.

References dest, SB(), and to_underlying().

Referenced by CmdModifyOrder().

## ◆ SetDepotActionType()

void Order::SetDepotActionType | ( | OrderDepotActionFlags | depot_service_type | ) |
| inline

Set what we are going to do in the depot.

Definition at line 173 of file order_base.h.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::base(), and SB().

Referenced by CmdModifyOrder(), CmdOrderRefit(), ConvertFromOldSavegame(), GetOrderCmdFromTile(), MakeGoToDepot(), and OrdersWindow::OrderClick_NearestDepot().

## ◆ SetDepotOrderType()

void Order::SetDepotOrderType | ( | OrderDepotTypeFlags | depot_order_type | ) |
| inline

Set the cause to go to the depot.

Definition at line 171 of file order_base.h.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::base(), and SB().

Referenced by CmdModifyOrder(), CmdOrderRefit(), ConvertFromOldSavegame(), and MakeGoToDepot().

## ◆ SetDestination()

void Order::SetDestination | ( | DestinationID | destination | ) |
| inline

Sets the destination of this order.

Parameters

  destination | the new destination of the order.

Precondition
  IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).

Definition at line 106 of file order_base.h.

References dest.

Referenced by UpdateOrderDest(), and UpdateWaypointOrder().

## ◆ SetLoadType()

void Order::SetLoadType | ( | OrderLoadType | load_type | ) |
| inline

Set how the consist must be loaded.

Definition at line 163 of file order_base.h.

References SB(), and to_underlying().

Referenced by CancelLoadingDueToDeletedOrder(), CmdModifyOrder(), ConvertFromOldSavegame(), and GetOrderCmdFromTile().

## ◆ SetMaxSpeed()

void Order::SetMaxSpeed | ( | uint16_t | speed | ) |
| inline

Set the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.

Parameters

  speed | Speed to be set.

Definition at line 231 of file order_base.h.

Referenced by ChangeTimetable().

## ◆ SetNonStopType()

void Order::SetNonStopType | ( | OrderNonStopFlags | non_stop_type | ) |
| inline

Set whether we must stop at stations or not.

Definition at line 167 of file order_base.h.

References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::base(), and SB().

Referenced by CancelLoadingDueToDeletedOrder(), CmdModifyOrder(), ConvertFromOldSavegame(), GetOrderCmdFromTile(), and MakeGoToDepot().

## ◆ SetRefit()

void Order::SetRefit | ( | CargoType | cargo | ) |

Make this depot/station order also a refit order.

Parameters

  cargo | the cargo type to change to.

Precondition
  IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).

Definition at line 148 of file order_cmd.cpp.

References refit_cargo.

Referenced by CmdModifyOrder(), CmdOrderRefit(), and MakeGoToDepot().

## ◆ SetStopLocation()

void Order::SetStopLocation | ( | OrderStopLocation | stop_location | ) |
| inline

Set where we must stop at the platform.

Definition at line 169 of file order_base.h.

References SB(), and to_underlying().

Referenced by CmdModifyOrder(), ConvertFromOldSavegame(), and GetOrderCmdFromTile().

## ◆ SetTravelTime()

void Order::SetTravelTime | ( | uint16_t | time | ) |
| inline

Set the time in ticks to take for travelling to the destination.

Parameters

  time | Time to set as travel time.

Definition at line 224 of file order_base.h.

Referenced by ChangeTimetable().

## ◆ SetTravelTimetabled()

void Order::SetTravelTimetabled | ( | bool | timetabled | ) |
| inline

Set if the travel time is explicitly timetabled (unless the order is conditional).

Definition at line 212 of file order_base.h.

References AssignBit(), and IsType().

Referenced by ChangeTimetable(), and RemoveOrderFromAllVehicles().

## ◆ SetUnloadType()

void Order::SetUnloadType | ( | OrderUnloadType | unload_type | ) |
| inline

Set how the consist must be unloaded.

Definition at line 165 of file order_base.h.

References SB(), and to_underlying().

Referenced by CmdModifyOrder(), and ConvertFromOldSavegame().

## ◆ SetWaitTime()

void Order::SetWaitTime | ( | uint16_t | time | ) |
| inline

Set the time in ticks to wait at the destination.

Parameters

  time | Time to set as wait time.

Definition at line 218 of file order_base.h.

Referenced by ChangeTimetable(), RemoveOrderFromAllVehicles(), and UpdateVehicleTimetable().

## ◆ SetWaitTimetabled()

void Order::SetWaitTimetabled | ( | bool | timetabled | ) |
| inline

Set if the wait time is explicitly timetabled (unless the order is conditional).

Definition at line 210 of file order_base.h.

References AssignBit(), and IsType().

Referenced by ChangeTimetable(), and RemoveOrderFromAllVehicles().

## ◆ ShouldStopAtStation()

bool Order::ShouldStopAtStation | ( | const Vehicle * | v,
|  | StationID | station
| ) |  | const

Check whether the given vehicle should stop at the given station based on this order and the non-stop settings.

Parameters

  v | the vehicle that might be stopping.
  station | the station to stop at.

Returns
  true if the vehicle should stop.

Definition at line 2176 of file order_cmd.cpp.

References dest, GetDepotOrderType(), GetNonStopType(), IsType(), Vehicle::last_station_visited, NoDestination, NoIntermediate, PartOfOrders, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by CheckNextTrainTile(), Train::GetCurrentMaxSpeed(), and Vehicle::ShowVisualEffect().

## Friends And Related Symbol Documentation

## ◆ GetOrderDescription

SaveLoadTable GetOrderDescription | ( |  | ) |
| friend

Saving and loading of orders.

Definition at line 144 of file order_sl.cpp.

## ◆ operator<<

template<typename Tcont , typename Titer >

EndianBufferWriter< Tcont, Titer > & operator<< | ( | EndianBufferWriter< Tcont, Titer > & | buffer,
|  | const Order & | data
| ) |  |
| friend

Definition at line 24 of file order_cmd.h.

## ◆ operator>>

class EndianBufferReader & operator>> | ( | class EndianBufferReader & | buffer,
|  | Order & | order
| ) |  |
| friend

Definition at line 41 of file order_cmd.h.

## ◆ SlOrders

template<typename T >

friend class SlOrders
| friend

Definition at line 41 of file order_base.h.

## ◆ SlVehicleCommon

friend class SlVehicleCommon
| friend

Definition at line 38 of file order_base.h.

## ◆ SlVehicleDisaster

friend class SlVehicleDisaster
| friend

Definition at line 39 of file order_base.h.

## ◆ VEHSChunkHandler

friend struct VEHSChunkHandler
| friend

Loading of ancient vehicles.

Definition at line 35 of file order_base.h.

## Field Documentation

## ◆ dest

DestinationID Order::dest {}
| private

The destination of the order.

Definition at line 49 of file order_base.h.

Referenced by AssignOrder(), Equals(), GetConditionValue(), GetConditionVariable(), GetDestination(), MakeConditional(), MakeGoToDepot(), MakeGoToStation(), MakeGoToWaypoint(), MakeImplicit(), SetConditionValue(), SetConditionVariable(), SetDestination(), and ShouldStopAtStation().

## ◆ flags

uint8_t Order::flags = 0
| private

Load/unload types, depot order/action types.

Definition at line 48 of file order_base.h.

Referenced by AssignOrder(), ConvertFromOldSavegame(), Equals(), GetConditionSkipToOrder(), VEHSChunkHandler::Load(), MakeConditional(), MakeDummy(), MakeGoToStation(), MakeGoToWaypoint(), MakeLeaveStation(), and MakeLoading().

## ◆ max_speed

uint16_t Order::max_speed = UINT16_MAX
| private

How fast the vehicle may go on the way to the destination.

Definition at line 55 of file order_base.h.

Referenced by AssignOrder(), and GetMaxSpeed().

## ◆ refit_cargo

CargoType Order::refit_cargo = CARGO_NO_REFIT
| private

Refit CargoType.

Definition at line 51 of file order_base.h.

Referenced by AssignOrder(), GetRefitCargo(), and SetRefit().

## ◆ travel_time

uint16_t Order::travel_time = 0
| private

How long in ticks the journey to this destination should take.

Definition at line 54 of file order_base.h.

Referenced by AssignOrder(), GetTimetabledTravel(), and GetTravelTime().

## ◆ type

uint8_t Order::type = 0
| private

The type of order + non-stop flags.

Definition at line 47 of file order_base.h.

Referenced by AssignOrder(), Equals(), IsFullLoadOrder(), IsType(), VEHSChunkHandler::Load(), MakeConditional(), MakeDummy(), MakeGoToDepot(), MakeGoToStation(), MakeGoToWaypoint(), MakeImplicit(), MakeLeaveStation(), and MakeLoading().

## ◆ wait_time

uint16_t Order::wait_time = 0
| private

How long in ticks to wait at the destination.

Definition at line 53 of file order_base.h.

Referenced by AssignOrder(), GetTimetabledWait(), and GetWaitTime().

The documentation for this struct was generated from the following files:

- src/order_base.h
- src/order_cmd.cpp
- src/saveload/order_sl.cpp