OpenTTD Source: src/order_type.h File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Enumerations | Variables
order_type.h File Reference

Types related to orders. More...

`#include "core/enum_type.hpp"`
`#include "depot_type.h"`
`#include "core/pool_type.hpp"`
`#include "station_type.h"`

Go to the source code of this file.

## Data Structures
struct | DestinationID

## Typedefs
typedef uint8_t | VehicleOrderID
| The index of an order within its current vehicle (not pool related)
using | OrderListID = PoolID< uint16_t, struct OrderListIDTag, 64000, 0xFFFF >
using | OrderNonStopFlags = EnumBitSet< OrderNonStopFlag, uint8_t >
using | OrderDepotTypeFlags = EnumBitSet< OrderDepotTypeFlag, uint8_t >
using | OrderDepotActionFlags = EnumBitSet< OrderDepotActionFlag, uint8_t >

## Enumerations
enum | OrderType : uint8_t { OT_BEGIN = 0 , OT_NOTHING = 0 , OT_GOTO_STATION = 1 , OT_GOTO_DEPOT = 2 , OT_LOADING = 3 , OT_LEAVESTATION = 4 , OT_DUMMY = 5 , OT_GOTO_WAYPOINT = 6 , OT_CONDITIONAL = 7 , OT_IMPLICIT = 8 , OT_END }
| Order types. More...
enum class | OrderUnloadType : uint8_t { UnloadIfPossible = 0 , Unload = 1 , Transfer = 2 , NoUnload = 4 }
| Unloading order types. More...
enum class | OrderLoadType : uint8_t { LoadIfPossible = 0 , FullLoad = 2 , FullLoadAny = 3 , NoLoad = 4 }
| Loading order types. More...
enum class | OrderNonStopFlag : uint8_t { NoIntermediate = 0 , NoDestination = 1 }
| Non-stop order flags. More...
enum class | OrderStopLocation : uint8_t { NearEnd = 0 , Middle = 1 , FarEnd = 2 , End }
| Where to stop the trains. More...
enum class | OrderDepotTypeFlag : uint8_t { Service = 0 , PartOfOrders = 1 }
| Reasons that could cause us to go to the depot. More...
enum class | OrderDepotActionFlag : uint8_t { Halt = 0 , NearestDepot = 1 , Unbunch = 2 }
| Actions that can be performed when the vehicle enters the depot. More...
enum class | OrderConditionVariable : uint8_t { LoadPercentage = 0 , Reliability = 1 , MaxSpeed = 2 , Age = 3 , RequiresService = 4 , Unconditionally = 5 , RemainingLifetime = 6 , MaxReliability = 7 , End }
| Variables (of a vehicle) to 'cause' skipping on. More...
enum class | OrderConditionComparator : uint8_t { Equal = 0 , NotEqual = 1 , LessThan = 2 , LessThanOrEqual = 3 , MoreThan = 4 , MoreThanOrEqual = 5 , IsTrue = 6 , IsFalse = 7 , End }
| Comparator for the skip reasoning. More...
enum | ModifyOrderFlags : uint8_t { MOF_NON_STOP , MOF_STOP_LOCATION , MOF_UNLOAD , MOF_LOAD , MOF_DEPOT_ACTION , MOF_COND_VARIABLE , MOF_COND_COMPARATOR , MOF_COND_VALUE , MOF_COND_DESTINATION , MOF_END }
| Enumeration for the data to set in CmdModifyOrder. More...
enum class | OrderDepotAction : uint8_t { AlwaysGo = 0 , Service = 1 , Stop = 2 , Unbunch = 3 , End }
| Depot action to switch to when doing a MOF_DEPOT_ACTION. More...
enum | ModifyTimetableFlags : uint8_t { MTF_WAIT_TIME , MTF_TRAVEL_TIME , MTF_TRAVEL_SPEED , MTF_END }
| Enumeration for the data to set in CmdChangeTimetable. More...
enum | CloneOptions : uint8_t { CO_SHARE = 0 , CO_COPY = 1 , CO_UNSHARE = 2 }
| Clone actions. More...

## Variables
static const VehicleOrderID | INVALID_VEH_ORDER_ID = 0xFF
| Invalid vehicle order index (sentinel)
static const VehicleOrderID | MAX_VEH_ORDER_ID = INVALID_VEH_ORDER_ID - 1
| Last valid VehicleOrderID.
static const uint | IMPLICIT_ORDER_ONLY_CAP = 32
| Maximum number of orders in implicit-only lists before we start searching harder for duplicates.

## Detailed Description

Types related to orders.

Definition in file order_type.h.

## Typedef Documentation

## ◆ OrderDepotActionFlags

using OrderDepotActionFlags = EnumBitSet<OrderDepotActionFlag, uint8_t>

Definition at line 123 of file order_type.h.

## ◆ OrderDepotTypeFlags

using OrderDepotTypeFlags = EnumBitSet<OrderDepotTypeFlag, uint8_t>

Definition at line 112 of file order_type.h.

## ◆ OrderListID

using OrderListID = PoolID<uint16_t, struct OrderListIDTag, 64000, 0xFFFF>

Definition at line 19 of file order_type.h.

## ◆ OrderNonStopFlags

using OrderNonStopFlags = EnumBitSet<OrderNonStopFlag, uint8_t>

Definition at line 92 of file order_type.h.

## ◆ VehicleOrderID

typedef uint8_t VehicleOrderID

The index of an order within its current vehicle (not pool related)

Definition at line 18 of file order_type.h.

## Enumeration Type Documentation

## ◆ CloneOptions

enum CloneOptions : uint8_t

Clone actions.

Definition at line 194 of file order_type.h.

## ◆ ModifyOrderFlags

enum ModifyOrderFlags : uint8_t

Enumeration for the data to set in CmdModifyOrder.

Enumerator
MOF_NON_STOP | Passes an OrderNonStopFlags.
MOF_STOP_LOCATION | Passes an OrderStopLocation.
MOF_UNLOAD | Passes an OrderUnloadType.
MOF_LOAD | Passes an OrderLoadType.
MOF_DEPOT_ACTION | Selects the OrderDepotAction.
MOF_COND_VARIABLE | A conditional variable changes.
MOF_COND_COMPARATOR | A comparator changes.
MOF_COND_VALUE | The value to set the condition to.
MOF_COND_DESTINATION | Change the destination of a conditional order.

Definition at line 159 of file order_type.h.

## ◆ ModifyTimetableFlags

enum ModifyTimetableFlags : uint8_t

Enumeration for the data to set in CmdChangeTimetable.

Enumerator
MTF_WAIT_TIME | Set wait time.
MTF_TRAVEL_TIME | Set travel time.
MTF_TRAVEL_SPEED | Set max travel speed.

Definition at line 186 of file order_type.h.

## ◆ OrderConditionComparator

enum class OrderConditionComparator : uint8_t
| strong

Comparator for the skip reasoning.

Enumerator
Equal | Skip if both values are equal.
NotEqual | Skip if both values are not equal.
LessThan | Skip if the value is less than the limit.
LessThanOrEqual | Skip if the value is less or equal to the limit.
MoreThan | Skip if the value is more than the limit.
MoreThanOrEqual | Skip if the value is more or equal to the limit.
IsTrue | Skip if the variable is true.
IsFalse | Skip if the variable is false.

Definition at line 143 of file order_type.h.

## ◆ OrderConditionVariable

enum class OrderConditionVariable : uint8_t
| strong

Variables (of a vehicle) to 'cause' skipping on.

Enumerator
LoadPercentage | Skip based on the amount of load.
Reliability | Skip based on the reliability.
MaxSpeed | Skip based on the maximum speed.
Age | Skip based on the age.
RequiresService | Skip when the vehicle requires service.
Unconditionally | Always skip.
RemainingLifetime | Skip based on the remaining lifetime.
MaxReliability | Skip based on the maximum reliability.

Definition at line 128 of file order_type.h.

## ◆ OrderDepotAction

enum class OrderDepotAction : uint8_t
| strong

Depot action to switch to when doing a MOF_DEPOT_ACTION.

Enumerator
AlwaysGo | Always go to the depot.
Service | Service only if needed.
Stop | Go to the depot and stop there.
Unbunch | Go to the depot and unbunch.

Definition at line 175 of file order_type.h.

## ◆ OrderDepotActionFlag

enum class OrderDepotActionFlag : uint8_t
| strong

Actions that can be performed when the vehicle enters the depot.

Enumerator
Halt | Service the vehicle and then halt it.
NearestDepot | Send the vehicle to the nearest depot.
Unbunch | Service the vehicle and then unbunch it.

Definition at line 117 of file order_type.h.

## ◆ OrderDepotTypeFlag

enum class OrderDepotTypeFlag : uint8_t
| strong

Reasons that could cause us to go to the depot.

Enumerator
Service | This depot order is because of the servicing limit.
PartOfOrders | This depot order is because of a regular order.

Definition at line 107 of file order_type.h.

## ◆ OrderLoadType

enum class OrderLoadType : uint8_t
| strong

Loading order types.

Enumerator
LoadIfPossible | Load as long as there is cargo that fits in the train.
FullLoad | Full load all cargoes of the consist.
FullLoadAny | Full load a single cargo of the consist.
NoLoad | Do not load anything.

Definition at line 77 of file order_type.h.

## ◆ OrderNonStopFlag

enum class OrderNonStopFlag : uint8_t
| strong

Non-stop order flags.

Enumerator
NoIntermediate | The vehicle will not stop at any stations it passes except the destination, aka non-stop.
NoDestination | The vehicle will stop at any station it passes except the destination, aka via.

Definition at line 87 of file order_type.h.

## ◆ OrderStopLocation

enum class OrderStopLocation : uint8_t
| strong

Where to stop the trains.

Enumerator
NearEnd | Stop at the near end of the platform.
Middle | Stop at the middle of the platform.
FarEnd | Stop at the far end of the platform.

Definition at line 97 of file order_type.h.

## ◆ OrderType

enum OrderType : uint8_t

Order types.

It needs to be 8bits, because we save and load it as such

Definition at line 50 of file order_type.h.

## ◆ OrderUnloadType

enum class OrderUnloadType : uint8_t
| strong

Unloading order types.

Enumerator
UnloadIfPossible | Unload all cargo that the station accepts.
Unload | Force unloading all cargo onto the platform, possibly not getting paid.
Transfer | Transfer all cargo onto the platform.
NoUnload | Totally no unloading will be done.

Definition at line 67 of file order_type.h.

## Variable Documentation

## ◆ IMPLICIT_ORDER_ONLY_CAP

const uint IMPLICIT_ORDER_ONLY_CAP = 32
| static

Maximum number of orders in implicit-only lists before we start searching harder for duplicates.

Definition at line 47 of file order_type.h.

Referenced by Vehicle::BeginLoading().

## ◆ INVALID_VEH_ORDER_ID

const VehicleOrderID INVALID_VEH_ORDER_ID = 0xFF
| static

Invalid vehicle order index (sentinel)

Definition at line 39 of file order_type.h.

Referenced by RefitWindow::BuildRefitList(), DeleteOrder(), Vehicle::DeleteUnreachedImplicitOrders(), TimetableWindow::DrawArrivalDeparturePanel(), OrdersWindow::DrawWidget(), RefitWindow::DrawWidget(), RefitWindow::GetCapacityString(), OrderList::GetFirstOrder(), OrderList::GetLastOrder(), OrderList::GetNext(), OrderList::GetNextDecisionNode(), OrderList::GetNextStoppingStation(), OrdersWindow::GetOrderFromPt(), InsertOrder(), OrdersWindow::OnClick(), RefitWindow::OnClick(), VehicleViewWindow::OnClick(), OrdersWindow::OnDragDrop(), RefitWindow::OnDragDrop(), OrdersWindow::OnInvalidateData(), TimetableWindow::OnInvalidateData(), OrdersWindow::OnMouseDrag(), RefitWindow::OnMouseDrag(), OrdersWindow::OnPlaceObjectAbort(), LinkRefresher::PredictNextOrder(), ProcessConditionalOrder(), LinkRefresher::RefreshLinks(), RemoveOrderFromAllVehicles(), LinkRefresher::Run(), VehicleOrderSaver::SwitchToNextOrder(), and UpdateOrderDest().

## ◆ MAX_VEH_ORDER_ID

const VehicleOrderID MAX_VEH_ORDER_ID = INVALID_VEH_ORDER_ID - 1
| static

Last valid VehicleOrderID.

Definition at line 41 of file order_type.h.

Referenced by Vehicle::BeginLoading(), and CmdInsertOrder().