OpenTTD
|
Public Member Functions | |
~Order () | |
Clean everything up. More... | |
Order (uint32 packed) | |
Create an order based on a packed representation of that order. More... | |
bool | IsType (OrderType type) const |
Check whether this order is of the given type. More... | |
OrderType | GetType () const |
Get the type of order of this order. More... | |
void | Free () |
'Free' the order More... | |
void | MakeGoToStation (StationID destination) |
Makes this order a Go To Station order. More... | |
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. More... | |
void | MakeGoToWaypoint (StationID destination) |
Makes this order a Go To Waypoint order. More... | |
void | MakeLoading (bool ordered) |
Makes this order a Loading order. More... | |
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. More... | |
void | MakeImplicit (StationID destination) |
Makes this order an implicit order. More... | |
bool | IsGotoOrder () const |
Is this a 'goto' order with a real destination? More... | |
DestinationID | GetDestination () const |
Gets the destination of this order. More... | |
void | SetDestination (DestinationID destination) |
Sets the destination of this order. More... | |
bool | IsRefit () const |
Is this order a refit order. More... | |
bool | IsAutoRefit () const |
Is this order a auto-refit order. More... | |
CargoID | GetRefitCargo () const |
Get the cargo to to refit to. More... | |
void | SetRefit (CargoID cargo) |
Make this depot/station order also a refit order. More... | |
OrderLoadFlags | GetLoadType () const |
How must the consist be loaded? | |
OrderUnloadFlags | 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. More... | |
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. More... | |
uint16 | GetConditionValue () const |
Get the value to base the skip on. More... | |
void | SetLoadType (OrderLoadFlags load_type) |
Set how the consist must be loaded. More... | |
void | SetUnloadType (OrderUnloadFlags unload_type) |
Set how the consist must be unloaded. More... | |
void | SetNonStopType (OrderNonStopFlags non_stop_type) |
Set whether we must stop at stations or not. More... | |
void | SetStopLocation (OrderStopLocation stop_location) |
Set where we must stop at the platform. More... | |
void | SetDepotOrderType (OrderDepotTypeFlags depot_order_type) |
Set the cause to go to the depot. More... | |
void | SetDepotActionType (OrderDepotActionFlags depot_service_type) |
Set what we are going to do in the depot. More... | |
void | SetConditionVariable (OrderConditionVariable condition_variable) |
Set variable we have to compare. More... | |
void | SetConditionComparator (OrderConditionComparator condition_comparator) |
Set the comparator to use. More... | |
void | SetConditionSkipToOrder (VehicleOrderID order_id) |
Get the order to skip to. More... | |
void | SetConditionValue (uint16 value) |
Set the value to base the skip on. More... | |
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 | GetTimetabledWait () const |
Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled. More... | |
uint16 | GetTimetabledTravel () const |
Get the time in ticks a vehicle should take to reach the destination or 0 if it's not timetabled. More... | |
uint16 | GetWaitTime () const |
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not). More... | |
uint16 | GetTravelTime () const |
Get the time in ticks a vehicle will probably take to reach the destination (timetabled or not). More... | |
uint16 | GetMaxSpeed () const |
Get the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination. More... | |
void | SetWaitTimetabled (bool timetabled) |
Set if the wait time is explicitly timetabled (unless the order is conditional). More... | |
void | SetTravelTimetabled (bool timetabled) |
Set if the travel time is explicitly timetabled (unless the order is conditional). More... | |
void | SetWaitTime (uint16 time) |
Set the time in ticks to wait at the destination. More... | |
void | SetTravelTime (uint16 time) |
Set the time in ticks to take for travelling to the destination. More... | |
void | SetMaxSpeed (uint16 speed) |
Set the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination. More... | |
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. More... | |
bool | CanLoadOrUnload () const |
bool | CanLeaveWithCargo (bool has_cargo) const |
A vehicle can leave the current station with cargo if: More... | |
TileIndex | GetLocation (const Vehicle *v, bool airport=false) const |
Returns a tile somewhat representing the order destination (not suitable for pathfinding). More... | |
bool | IsCompletelyTimetabled () const |
Checks if travel_time and wait_time apply to this order and if they are timetabled. More... | |
void | AssignOrder (const Order &other) |
Assign data to an order (from another order) This function makes sure that the index is maintained correctly. More... | |
bool | Equals (const Order &other) const |
Does this order have the same type, flags and destination? More... | |
uint32 | Pack () const |
Pack this order into a 32 bits integer, or actually only the type, flags and destination. More... | |
uint16 | MapOldOrder () const |
Pack this order into a 16 bits integer as close to the TTD representation as possible. More... | |
void | ConvertFromOldSavegame () |
Converts this order from an old savegame's version; it moves all bits to the new location. | |
![]() | |
void * | operator new (size_t size) |
Allocates space for new Titem. More... | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. More... | |
void * | operator new (size_t size, void *ptr) |
Allocates space for new Titem at given memory address. More... | |
void | operator delete (void *p) |
Marks Titem as free. More... | |
Data Fields | |
Order * | next |
Pointer to next order. If NULL, end of list. | |
![]() | |
Tindex | index |
Index of this pool item. | |
Private Attributes | |
uint8 | type |
The type of order + non-stop flags. | |
uint8 | flags |
Load/unload types, depot order/action types. | |
DestinationID | dest |
The destination of the order. | |
CargoID | refit_cargo |
Refit CargoID. | |
uint16 | wait_time |
How long in ticks to wait at the destination. | |
uint16 | travel_time |
How long in ticks the journey to this destination should take. | |
uint16 | max_speed |
How fast the vehicle may go on the way to the destination. | |
Friends | |
const struct SaveLoad * | GetVehicleDescription (VehicleType vt) |
Saving and loading the current order of vehicles. More... | |
void | Load_VEHS () |
Loading of ancient vehicles. More... | |
const struct SaveLoad * | GetOrderDescription () |
Saving and loading of orders. | |
Additional Inherited Members | |
![]() | |
static bool | CanAllocateItem (size_t n=1) |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() More... | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. More... | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-NULL) Titem. More... | |
static Titem * | Get (size_t index) |
Returns Titem with given index. More... | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. More... | |
static size_t | GetPoolSize () |
Returns first unused index. More... | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. More... | |
static void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. More... | |
Definition at line 34 of file order_base.h.
Order::~Order | ( | ) |
Clean everything up.
Definition at line 48 of file order_cmd.cpp.
Order::Order | ( | uint32 | packed | ) |
Create an order based on a packed representation of that order.
packed | the packed representation. |
Definition at line 235 of file order_cmd.cpp.
References CT_NO_REFIT, dest, flags, GB(), max_speed, next, refit_cargo, travel_time, type, and wait_time.
void Order::AssignOrder | ( | const Order & | other | ) |
Assign data to an order (from another order) This function makes sure that the index is maintained correctly.
other | the data to copy (except next pointer). |
Definition at line 274 of file order_cmd.cpp.
References dest, flags, max_speed, refit_cargo, travel_time, type, and wait_time.
bool Order::CanLeaveWithCargo | ( | bool | has_cargo | ) | const |
A vehicle can leave the current station with cargo if:
Definition at line 2283 of file order_cmd.cpp.
References GetLoadType(), GetUnloadType(), OLFB_NO_LOAD, OUFB_TRANSFER, and OUFB_UNLOAD.
Referenced by SetMaxSpeed().
bool Order::Equals | ( | const Order & | other | ) | const |
Does this order have the same type, flags and destination?
other | the second order to compare to. |
Definition at line 176 of file order_cmd.cpp.
References IsType().
void Order::Free | ( | ) |
'Free' the order
Definition at line 64 of file order_cmd.cpp.
References type.
Referenced by GetOrderCmdFromTile(), GetType(), and UpdateOrderDest().
|
inline |
|
inline |
|
inline |
What are we going to do when in the depot.
Definition at line 139 of file order_base.h.
References GB().
|
inline |
Gets the destination of this order.
Definition at line 96 of file order_base.h.
References dest.
Referenced by AircraftController(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Zeppeliner(), LinkRefresher::RefreshStats(), ReleaseDisastersTargetingIndustry(), and ReleaseDisastersTargetingVehicle().
Returns a tile somewhat representing the order destination (not suitable for pathfinding).
v | The vehicle to get the location for. |
airport | Get the airport tile and not the station location for aircraft. |
Definition at line 670 of file order_cmd.cpp.
References GetType().
Referenced by VehicleViewWindow::OnClick(), and SetMaxSpeed().
|
inline |
Get the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.
Definition at line 194 of file order_base.h.
References max_speed.
|
inline |
Get the cargo to to refit to.
Definition at line 124 of file order_base.h.
References refit_cargo, and SetRefit().
|
inline |
Get the time in ticks a vehicle should take to reach the destination or 0 if it's not timetabled.
Definition at line 183 of file order_base.h.
References IsTravelTimetabled(), and travel_time.
Referenced by ChangeTimetable().
|
inline |
Get the time in ticks a vehicle should wait at the destination or 0 if it's not timetabled.
Definition at line 181 of file order_base.h.
References IsWaitTimetabled(), and wait_time.
Referenced by ChangeTimetable().
|
inline |
Get the time in ticks a vehicle will probably take to reach the destination (timetabled or not).
Definition at line 187 of file order_base.h.
References travel_time.
Referenced by ChangeTimetable().
|
inline |
Get the type of order of this order.
Definition at line 69 of file order_base.h.
References CT_NO_REFIT, Free(), GB(), MakeConditional(), MakeDummy(), MakeGoToDepot(), MakeGoToStation(), MakeGoToWaypoint(), MakeImplicit(), MakeLeaveStation(), MakeLoading(), ODATF_SERVICE_ONLY, and ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS.
Referenced by CheckNextTrainTile(), CmdInsertOrder(), ConvertFromOldSavegame(), GetLocation(), IsType(), MapOldOrder(), ProcessConditionalOrder(), ProcessOrders(), UpdateOrderDest(), and CYapfDestinationTileOrStationRailT< Types >::Yapf().
|
inline |
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not).
Definition at line 185 of file order_base.h.
References wait_time.
Referenced by ChangeTimetable().
|
inline |
Is this order a auto-refit order.
Definition at line 117 of file order_base.h.
References CT_AUTO_REFIT.
|
inline |
Checks if travel_time and wait_time apply to this order and if they are timetabled.
Definition at line 227 of file order_base.h.
References IsTravelTimetabled(), and IsType().
|
inline |
Is this a 'goto' order with a real destination?
Definition at line 86 of file order_base.h.
References IsType().
|
inline |
Is this order a refit order.
Definition at line 110 of file order_base.h.
References CT_AUTO_REFIT, and NUM_CARGO.
Referenced by ReserveConsist().
|
inline |
Check whether this order is of the given type.
type | the type to check against. |
Definition at line 63 of file order_base.h.
References GetType(), and type.
Referenced by AircraftEntersTerminal(), AircraftEventHandler_InHangar(), AircraftNextAirportPos_and_Order(), CalcPercentVehicleFilled(), CanDetermineTimeTaken(), CheckTrainStayInDepot(), CmdChangeTimetable(), CmdOrderRefit(), CmdRefitVehicle(), CmdSkipToOrder(), CmdTurnRoadVeh(), OrderList::DeleteOrderAt(), Vehicle::DeleteUnreachedImplicitOrders(), DeleteVehicleOrders(), VehicleViewWindow::DrawWidget(), Equals(), OrderList::GetNextDecisionNode(), GetOrderDistance(), GetTrainStopLocation(), OrderList::InsertOrderAt(), IsCompletelyTimetabled(), IsGotoOrder(), IsTravelTimetabled(), IsWaitTimetabled(), TimetableWindow::OnPaint(), OrdersWindow::OnPlaceObject(), OrderGoesToStation(), LinkRefresher::PredictNextOrder(), LinkRefresher::RefreshLinks(), RemoveOrderFromAllVehicles(), VehicleResolverObject::ResolveReal(), OrdersWindow::SetStringParameters(), SetTravelTimetabled(), SetWaitTimetabled(), ShouldStopAtStation(), CYapfFollowRoadT< Types >::TransportTypeChar(), UnpackOldOrder(), UpdateVehicleTimetable(), UpdateWaypointOrder(), and VehicleTimetableSorter().
void Order::MakeConditional | ( | VehicleOrderID | order | ) |
Makes this order an conditional order.
order | the order to jump to. |
Definition at line 144 of file order_cmd.cpp.
References type.
Referenced by GetType().
void Order::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.
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 91 of file order_cmd.cpp.
References type.
Referenced by GetOrderCmdFromTile(), GetType(), and OrdersWindow::OrderClick_NearestDepot().
void Order::MakeGoToStation | ( | StationID | destination | ) |
Makes this order a Go To Station order.
destination | the station to go to. |
Definition at line 76 of file order_cmd.cpp.
References type.
Referenced by GetOrderCmdFromTile(), and GetType().
void Order::MakeGoToWaypoint | ( | StationID | destination | ) |
Makes this order a Go To Waypoint order.
destination | the waypoint to go to. |
Definition at line 105 of file order_cmd.cpp.
References type.
Referenced by GetOrderCmdFromTile(), and GetType().
void Order::MakeImplicit | ( | StationID | destination | ) |
Makes this order an implicit order.
destination | the station to go to. |
Definition at line 155 of file order_cmd.cpp.
References type.
Referenced by GetType().
void Order::MakeLoading | ( | bool | ordered | ) |
Makes this order a Loading order.
ordered | is this an ordered stop? |
Definition at line 116 of file order_cmd.cpp.
References type.
Referenced by GetType().
uint16 Order::MapOldOrder | ( | ) | const |
Pack this order into a 16 bits integer as close to the TTD representation as possible.
Definition at line 209 of file order_cmd.cpp.
uint32 Order::Pack | ( | ) | const |
Pack this order into a 32 bits integer, or actually only the type, flags and destination.
Definition at line 199 of file order_cmd.cpp.
References dest, flags, and type.
Referenced by OrdersWindow::OrderClick_NearestDepot().
|
inline |
|
inline |
Get the order to skip to.
Definition at line 166 of file order_base.h.
|
inline |
|
inline |
|
inline |
Set what we are going to do in the depot.
Definition at line 160 of file order_base.h.
References SB().
Referenced by OrdersWindow::OrderClick_NearestDepot().
|
inline |
Set the cause to go to the depot.
Definition at line 158 of file order_base.h.
References SB().
Referenced by GetOrderCmdFromTile().
|
inline |
Sets the destination of this order.
destination | the new destination of the order. |
Definition at line 103 of file order_base.h.
Referenced by ReleaseDisastersTargetingIndustry(), and ReleaseDisastersTargetingVehicle().
|
inline |
Set how the consist must be loaded.
Definition at line 150 of file order_base.h.
References SB().
Referenced by GetOrderCmdFromTile().
|
inline |
Set the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination.
speed | Speed to be set. |
Definition at line 218 of file order_base.h.
References CanLeaveWithCargo(), GetLocation(), and ShouldStopAtStation().
Referenced by ChangeTimetable().
|
inline |
Set whether we must stop at stations or not.
Definition at line 154 of file order_base.h.
References SB().
Referenced by ConvertFromOldSavegame(), and GetOrderCmdFromTile().
void Order::SetRefit | ( | CargoID | cargo | ) |
Make this depot/station order also a refit order.
cargo | the cargo type to change to. |
Definition at line 166 of file order_cmd.cpp.
References refit_cargo.
Referenced by GetRefitCargo().
|
inline |
Set where we must stop at the platform.
Definition at line 156 of file order_base.h.
References SB().
Referenced by GetOrderCmdFromTile().
|
inline |
Set the time in ticks to take for travelling to the destination.
time | Time to set as travel time. |
Definition at line 211 of file order_base.h.
Referenced by ChangeTimetable().
|
inline |
Set if the travel time is explicitly timetabled (unless the order is conditional).
Definition at line 199 of file order_base.h.
References IsType().
Referenced by ChangeTimetable().
|
inline |
|
inline |
Set the time in ticks to wait at the destination.
time | Time to set as wait time. |
Definition at line 205 of file order_base.h.
Referenced by ChangeTimetable().
|
inline |
Set if the wait time is explicitly timetabled (unless the order is conditional).
Definition at line 197 of file order_base.h.
References IsType().
Referenced by ChangeTimetable().
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.
v | the vehicle that might be stopping. |
station | the station to stop at. |
Definition at line 2259 of file order_cmd.cpp.
References IsType().
Referenced by SetMaxSpeed().
|
friend |
Saving and loading the current order of vehicles.
The vehicles have a cargo list (and we want that saved).
vt | the vehicle type. Can be VEH_END for the common vehicle description data |
vt | the vehicle type. Can be VEH_END for the common vehicle description data |
Save and load of vehicles
Save and load of vehicles
Definition at line 574 of file vehicle_sl.cpp.
|
friend |
Loading of ancient vehicles.
Definition at line 883 of file vehicle_sl.cpp.