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

Types related to orders. More...

#include "core/enum_type.hpp"

Go to the source code of this file.

Data Structures

struct  EnumPropsT< ModifyOrderFlags >
 
struct  EnumPropsT< ModifyTimetableFlags >
 

Typedefs

typedef byte VehicleOrderID
 The index of an order within its current vehicle (not pool related)
 
typedef uint16 OrderID
 
typedef uint16 OrderListID
 
typedef uint16 DestinationID
 
typedef SimpleTinyEnumT< OrderType, byte > OrderTypeByte
 It needs to be 8bits, because we save and load it as such.
 

Enumerations

enum  OrderType {
  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.
 
enum  OrderUnloadFlags { OUF_UNLOAD_IF_POSSIBLE = 0, OUFB_UNLOAD = 1 << 0, OUFB_TRANSFER = 1 << 1, OUFB_NO_UNLOAD = 1 << 2 }
 Flags related to the unloading order. More...
 
enum  OrderLoadFlags { OLF_LOAD_IF_POSSIBLE = 0, OLFB_FULL_LOAD = 1 << 1, OLF_FULL_LOAD_ANY = 3, OLFB_NO_LOAD = 4 }
 Flags related to the loading order. More...
 
enum  OrderNonStopFlags {
  ONSF_STOP_EVERYWHERE = 0, ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, ONSF_NO_STOP_AT_DESTINATION_STATION = 2, ONSF_NO_STOP_AT_ANY_STATION = 3,
  ONSF_END
}
 Non-stop order flags. More...
 
enum  OrderStopLocation { OSL_PLATFORM_NEAR_END = 0, OSL_PLATFORM_MIDDLE = 1, OSL_PLATFORM_FAR_END = 2, OSL_END }
 Where to stop the trains. More...
 
enum  OrderDepotTypeFlags { ODTF_MANUAL = 0, ODTFB_SERVICE = 1 << 0, ODTFB_PART_OF_ORDERS = 1 << 1 }
 Reasons that could cause us to go to the depot. More...
 
enum  OrderDepotActionFlags { ODATF_SERVICE_ONLY = 0, ODATFB_HALT = 1 << 0, ODATFB_NEAREST_DEPOT = 1 << 1 }
 Actions that can be performed when the vehicle enters the depot. More...
 
enum  OrderConditionVariable {
  OCV_LOAD_PERCENTAGE, OCV_RELIABILITY, OCV_MAX_SPEED, OCV_AGE,
  OCV_REQUIRES_SERVICE, OCV_UNCONDITIONALLY, OCV_REMAINING_LIFETIME, OCV_END
}
 Variables (of a vehicle) to 'cause' skipping on. More...
 
enum  OrderConditionComparator {
  OCC_EQUALS, OCC_NOT_EQUALS, OCC_LESS_THAN, OCC_LESS_EQUALS,
  OCC_MORE_THAN, OCC_MORE_EQUALS, OCC_IS_TRUE, OCC_IS_FALSE,
  OCC_END
}
 Comparator for the skip reasoning. More...
 
enum  ModifyOrderFlags {
  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  OrderDepotAction { DA_ALWAYS_GO, DA_SERVICE, DA_STOP, DA_END }
 Depot action to switch to when doing a MOF_DEPOT_ACTION. More...
 
enum  ModifyTimetableFlags { MTF_WAIT_TIME, MTF_TRAVEL_TIME, MTF_TRAVEL_SPEED, MTF_END }
 Enumeration for the data to set in CmdChangeTimetable. More...
 
enum  CloneOptions { 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. More...
 
static const OrderID INVALID_ORDER = 0xFFFF
 Invalid order (sentinel)
 
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.

Enumeration Type Documentation

◆ CloneOptions

Clone actions.

Definition at line 185 of file order_type.h.

◆ ModifyOrderFlags

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 148 of file order_type.h.

◆ ModifyTimetableFlags

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 175 of file order_type.h.

◆ OrderConditionComparator

Comparator for the skip reasoning.

Enumerator
OCC_EQUALS 

Skip if both values are equal.

OCC_NOT_EQUALS 

Skip if both values are not equal.

OCC_LESS_THAN 

Skip if the value is less than the limit.

OCC_LESS_EQUALS 

Skip if the value is less or equal to the limit.

OCC_MORE_THAN 

Skip if the value is more than the limit.

OCC_MORE_EQUALS 

Skip if the value is more or equal to the limit.

OCC_IS_TRUE 

Skip if the variable is true.

OCC_IS_FALSE 

Skip if the variable is false.

Definition at line 132 of file order_type.h.

◆ OrderConditionVariable

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

Enumerator
OCV_LOAD_PERCENTAGE 

Skip based on the amount of load.

OCV_RELIABILITY 

Skip based on the reliability.

OCV_MAX_SPEED 

Skip based on the maximum speed.

OCV_AGE 

Skip based on the age.

OCV_REQUIRES_SERVICE 

Skip when the vehicle requires service.

OCV_UNCONDITIONALLY 

Always skip.

OCV_REMAINING_LIFETIME 

Skip based on the remaining lifetime.

Definition at line 118 of file order_type.h.

◆ OrderDepotAction

Depot action to switch to when doing a MOF_DEPOT_ACTION.

Enumerator
DA_ALWAYS_GO 

Always go to the depot.

DA_SERVICE 

Service only if needed.

DA_STOP 

Go to the depot and stop there.

Definition at line 165 of file order_type.h.

◆ OrderDepotActionFlags

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

Enumerator
ODATF_SERVICE_ONLY 

Only service the vehicle.

ODATFB_HALT 

Service the vehicle and then halt it.

ODATFB_NEAREST_DEPOT 

Send the vehicle to the nearest depot.

Definition at line 108 of file order_type.h.

◆ OrderDepotTypeFlags

Reasons that could cause us to go to the depot.

Enumerator
ODTF_MANUAL 

Manually initiated order.

ODTFB_SERVICE 

This depot order is because of the servicing limit.

ODTFB_PART_OF_ORDERS 

This depot order is because of a regular order.

Definition at line 99 of file order_type.h.

◆ OrderLoadFlags

Flags related to the loading order.

Enumerator
OLF_LOAD_IF_POSSIBLE 

Load as long as there is cargo that fits in the train.

OLFB_FULL_LOAD 

Full load all cargoes of the consist.

OLF_FULL_LOAD_ANY 

Full load a single cargo of the consist.

OLFB_NO_LOAD 

Do not load anything.

Definition at line 68 of file order_type.h.

◆ OrderNonStopFlags

Non-stop order flags.

Enumerator
ONSF_STOP_EVERYWHERE 

The vehicle will stop at any station it passes and the destination.

ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS 

The vehicle will not stop at any stations it passes except the destination.

ONSF_NO_STOP_AT_DESTINATION_STATION 

The vehicle will stop at any station it passes except the destination.

ONSF_NO_STOP_AT_ANY_STATION 

The vehicle will not stop at any stations it passes including the destination.

Definition at line 78 of file order_type.h.

◆ OrderStopLocation

Where to stop the trains.

Enumerator
OSL_PLATFORM_NEAR_END 

Stop at the near end of the platform.

OSL_PLATFORM_MIDDLE 

Stop at the middle of the platform.

OSL_PLATFORM_FAR_END 

Stop at the far end of the platform.

Definition at line 89 of file order_type.h.

◆ OrderUnloadFlags

Flags related to the unloading order.

Enumerator
OUF_UNLOAD_IF_POSSIBLE 

Unload all cargo that the station accepts.

OUFB_UNLOAD 

Force unloading all cargo onto the platform, possibly not getting paid.

OUFB_TRANSFER 

Transfer all cargo onto the platform.

OUFB_NO_UNLOAD 

Totally no unloading will be done.

Definition at line 58 of file order_type.h.

Variable Documentation

◆ MAX_VEH_ORDER_ID

const VehicleOrderID MAX_VEH_ORDER_ID = INVALID_VEH_ORDER_ID - 1
static

Last valid VehicleOrderID.

Definition at line 25 of file order_type.h.