Public Member Functions | |
~Order () | |
Clean everything up. | |
Order (uint32 packed) | |
Create an order based on a packed representation of that order. | |
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 (DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type=ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action=ODATF_SERVICE_ONLY, CargoID cargo=CT_NO_REFIT, byte subtype=0) |
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. | |
CargoID | GetRefitCargo () const |
Get the cargo to to refit to. | |
byte | GetRefitSubtype () const |
Get the cargo subtype to to refit to. | |
void | SetRefit (CargoID cargo, byte subtype=0) |
Make this depot/station order also a refit order. | |
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. | |
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 | GetConditionValue () const |
Get the value to base the skip on. | |
void | SetLoadType (OrderLoadFlags load_type) |
Set how the consist must be loaded. | |
void | SetUnloadType (OrderUnloadFlags 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 value) |
Set the value to base the skip on. | |
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: 1. | |
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 this order has travel_time and if needed wait_time set. | |
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? | |
uint32 | Pack () const |
Pack this order into a 32 bits integer, or actually only the type, flags and destination. | |
uint16 | 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. | |
Data Fields | |
Order * | next |
Pointer to next order. If NULL, end of list. | |
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. | |
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. | |
byte | refit_subtype |
Refit subtype. | |
Friends | |
struct SaveLoad * | GetVehicleDescription (VehicleType vt) |
Saving and loading the current order of vehicles. | |
void | Load_VEHS () |
Loading of ancient vehicles. | |
struct SaveLoad * | GetOrderDescription () |
Saving and loading of orders. |
Definition at line 34 of file order_base.h.
Order::~Order | ( | ) |
Clean everything up.
Definition at line 45 of file order_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::GetIfValid(), InvalidateWindowClassesData(), BaseStation::owner, OWNER_NONE, and WC_STATION_LIST.
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 dest, flags, GB(), max_speed, next, refit_cargo, refit_subtype, 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 275 of file order_cmd.cpp.
References dest, flags, max_speed, refit_cargo, refit_subtype, travel_time, type, and wait_time.
Referenced by CmdInsertOrder(), LoadOldVehicle(), and OrderBackup::OrderBackup().
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 2276 of file order_cmd.cpp.
References GetLoadType(), GetUnloadType(), OLFB_NO_LOAD, and OUFB_UNLOAD.
Referenced by Vehicle::LeaveStation(), and Vehicle::RefreshNextHopsStats().
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 dest, flags, GetDepotActionType(), GetDepotOrderType(), IsType(), and type.
Referenced by ChangeTimetable(), CheckOrders(), and ProcessOrders().
void Order::Free | ( | ) |
'Free' the order
Definition at line 61 of file order_cmd.cpp.
References dest, flags, next, and type.
Referenced by AfterLoadVehicles(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), InitializeDisasterVehicle(), ProcessOrders(), RemoveDock(), and UpdateOrderDest().
VehicleOrderID Order::GetConditionSkipToOrder | ( | ) | const [inline] |
Get the order to skip to.
Definition at line 153 of file order_base.h.
References flags.
Referenced by CmdInsertOrder(), CmdMoveOrder(), DeleteOrder(), DrawOrderString(), OrderList::GetNextStoppingOrder(), GetOrderDistance(), InsertOrder(), and ProcessConditionalOrder().
uint16 Order::GetConditionValue | ( | ) | const [inline] |
Get the value to base the skip on.
Definition at line 155 of file order_base.h.
Referenced by CmdInsertOrder(), CmdModifyOrder(), DrawOrderString(), OrdersWindow::OnClick(), ProcessConditionalOrder(), and OrdersWindow::SetStringParameters().
OrderDepotActionFlags Order::GetDepotActionType | ( | ) | const [inline] |
What are we going to do when in the depot.
Definition at line 147 of file order_base.h.
Referenced by CmdInsertOrder(), CmdModifyOrder(), CmdOrderRefit(), DrawOrderString(), VehicleViewWindow::DrawWidget(), Equals(), GenerateVehicleSortList(), GetLocation(), OrderList::GetNextStoppingOrder(), OrderGoesToStation(), RemoveOrderFromAllVehicles(), Vehicle::SendToDepot(), UpdateOrderDest(), and VehicleEnterDepot().
DestinationID Order::GetDestination | ( | ) | const [inline] |
Gets the destination of this order.
Definition at line 97 of file order_base.h.
References dest.
Referenced by AfterLoadGame(), AircraftController(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), AircraftNextAirportPos_and_Order(), Vehicle::BeginLoading(), CheckIfTrainNeedsService(), CheckNextTrainTile(), CheckOrders(), CmdCloneOrder(), CmdInsertOrder(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Big_Ufo_Destroyer(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), DrawOrderString(), VehicleViewWindow::DrawWidget(), GenerateVehicleSortList(), OrderList::GetBestLoadableNext(), GetLocation(), OrderList::GetNextStoppingStation(), GetTrainStopLocation(), Vehicle::HandleLoading(), HasStationInUse(), OrderList::InsertOrderAt(), MapOldOrder(), Train::OnNewDay(), CYapfCostRailT< Types >::PfCalcCost(), ProcessOrders(), Vehicle::RefreshNextHopsStats(), ReleaseDisastersTargetingIndustry(), ReleaseDisastersTargetingVehicle(), RemoveOrderFromAllVehicles(), UpdateOrderDest(), UpdateWaypointOrder(), VehicleEnterDepot(), and WhoCanServiceIndustry().
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 695 of file order_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_order_pool >::Get(), GetDepotActionType(), GetDestination(), GetType(), INVALID_TILE, ODATFB_NEAREST_DEPOT, BaseVehicle::type, and VEH_AIRCRAFT.
Referenced by GetOrderDistance(), VehicleViewWindow::OnClick(), and OrdersWindow::OnClick().
CargoID Order::GetRefitCargo | ( | ) | const [inline] |
Get the cargo to to refit to.
Definition at line 125 of file order_base.h.
References refit_cargo.
Referenced by DrawOrderString(), LoadUnloadVehicle(), Vehicle::RefreshNextHopsStats(), UpdateOrderDest(), VehicleEnterDepot(), and VerifyAutoreplaceRefitForOrders().
byte Order::GetRefitSubtype | ( | ) | const [inline] |
Get the cargo subtype to to refit to.
Definition at line 132 of file order_base.h.
References refit_subtype.
Referenced by LoadUnloadVehicle(), Vehicle::RefreshNextHopsStats(), UpdateOrderDest(), and VehicleEnterDepot().
OrderType Order::GetType | ( | ) | const [inline] |
Get the type of order of this order.
Definition at line 70 of file order_base.h.
Referenced by AircraftEventHandler_AtTerminal(), CheckForValidOrders(), CheckNextTrainTile(), CmdChangeTimetable(), CmdInsertOrder(), CmdModifyOrder(), ConvertFromOldSavegame(), DrawOrderString(), VehicleViewWindow::DrawWidget(), GetLocation(), Vehicle::HandleLoading(), IsType(), MapOldOrder(), ProcessConditionalOrder(), ProcessOrders(), RemoveOrderFromAllVehicles(), ReverseTrainDirection(), VehicleOrderSaver::SwitchToNextOrder(), and UpdateOrderDest().
bool Order::IsAutoRefit | ( | ) | const [inline] |
Is this order a auto-refit order.
Definition at line 118 of file order_base.h.
References refit_cargo.
Referenced by DrawOrderString(), and VerifyAutoreplaceRefitForOrders().
bool Order::IsCompletelyTimetabled | ( | ) | const [inline] |
Checks if this order has travel_time and if needed wait_time set.
Definition at line 185 of file order_base.h.
References GetNonStopType(), IsType(), ONSF_NO_STOP_AT_DESTINATION_STATION, travel_time, and wait_time.
bool Order::IsGotoOrder | ( | ) | const [inline] |
Is this a 'goto' order with a real destination?
Definition at line 87 of file order_base.h.
References IsType().
Referenced by DrawOrderString().
bool Order::IsRefit | ( | ) | const [inline] |
Is this order a refit order.
Definition at line 111 of file order_base.h.
References NUM_CARGO, and refit_cargo.
Referenced by DrawOrderString(), OrderList::GetNextStoppingOrder(), LoadUnloadVehicle(), VehicleEnterDepot(), and VerifyAutoreplaceRefitForOrders().
bool Order::IsType | ( | OrderType | type | ) | const [inline] |
Check whether this order is of the given type.
type | the type to check against. |
Definition at line 64 of file order_base.h.
References GetType().
Referenced by AfterLoadGame(), AircraftEntersTerminal(), AircraftEventHandler_AtTerminal(), AircraftEventHandler_InHangar(), AircraftNextAirportPos_and_Order(), Vehicle::BeginLoading(), TimetableWindow::BuildArrivalDepartureList(), CancelLoadingDueToDeletedOrder(), CanDetermineTimeTaken(), CheckIfTrainNeedsService(), CheckOrders(), CheckTrainStayInDepot(), CmdBuildSingleSignal(), CmdChangeTimetable(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdOrderRefit(), CmdRefitVehicle(), CmdReverseTrainDirection(), CmdSkipToOrder(), CmdTurnRoadVeh(), ConvertFromOldSavegame(), DeleteOrder(), OrderList::DeleteOrderAt(), Vehicle::DeleteUnreachedImplicitOrders(), DeleteVehicleOrders(), DrawOrderString(), VehicleViewWindow::DrawWidget(), TimetableWindow::DrawWidget(), Equals(), FillTimetableArrivalDepartureTable(), FixOldVehicles(), GenerateVehicleSortList(), OrderList::GetNextStoppingOrder(), OrderList::GetNextStoppingStation(), GetOrderDistance(), GetTrainStopLocation(), Vehicle::HandleBreakdown(), Vehicle::HandleLoading(), Vehicle::HasDepotOrder(), HasStationInUse(), InsertOrder(), OrderList::InsertOrderAt(), IsCompletelyTimetabled(), IsGotoOrder(), Vehicle::LeaveStation(), LoadUnloadVehicle(), MapAircraftMovementAction(), Vehicle::NeedsAutomaticServicing(), OrdersWindow::OnClick(), Train::OnNewDay(), TimetableWindow::OnPaint(), OrdersWindow::OnPlaceObject(), OrderGoesToStation(), CYapfCostRailT< Types >::PfCalcCost(), ProcessOrders(), Vehicle::RefreshNextHopsStats(), RemoveDock(), RemoveOrderFromAllVehicles(), RemoveRoadStop(), Vehicle::SendToDepot(), OrdersWindow::SetStringParameters(), ShouldStopAtStation(), UnpackOldOrder(), UpdateOldAircraft(), UpdateVehicleTimetable(), UpdateWaypointOrder(), VehicleEnterDepot(), and WhoCanServiceIndustry().
void Order::MakeConditional | ( | VehicleOrderID | order | ) |
Makes this order an conditional order.
order | the order to jump to. |
Definition at line 142 of file order_cmd.cpp.
References dest, flags, and type.
Referenced by OrdersWindow::OnClick().
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 , |
|||
byte | subtype = 0 | |||
) |
Makes this order a Go To Depot order.
destination | the depot to go to. | |
order | is this order a 'default' order, or an overriden 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. | |
subtype | the subtype to change to. |
Definition at line 89 of file order_cmd.cpp.
References dest, SetDepotActionType(), SetDepotOrderType(), SetNonStopType(), SetRefit(), and type.
Referenced by CheckIfTrainNeedsService(), OrdersWindow::OrderClick_NearestDepot(), Vehicle::SendToDepot(), and UpdateOrderDest().
void Order::MakeGoToStation | ( | StationID | destination | ) |
void Order::MakeGoToWaypoint | ( | StationID | destination | ) |
Makes this order a Go To Waypoint order.
destination | the waypoint to go to. |
Definition at line 103 of file order_cmd.cpp.
References dest, flags, and type.
Referenced by UpdateWaypointOrder().
void Order::MakeImplicit | ( | StationID | destination | ) |
Makes this order an implicit order.
destination | the station to go to. |
Definition at line 153 of file order_cmd.cpp.
Referenced by Vehicle::BeginLoading().
void Order::MakeLoading | ( | bool | ordered | ) |
Makes this order a Loading order.
ordered | is this an ordered stop? |
Definition at line 114 of file order_cmd.cpp.
Referenced by Vehicle::BeginLoading().
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.
References GB(), GetDepotOrderType(), GetDestination(), GetLoadType(), GetNonStopType(), GetType(), GetUnloadType(), ODTFB_PART_OF_ORDERS, OLFB_FULL_LOAD, ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OUFB_UNLOAD, SetBit(), and type.
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::OnClick(), OrdersWindow::OnPlaceObject(), and OrdersWindow::OrderClick_NearestDepot().
void Order::SetConditionComparator | ( | OrderConditionComparator | condition_comparator | ) | [inline] |
Set the comparator to use.
Definition at line 172 of file order_base.h.
Referenced by CmdModifyOrder().
void Order::SetConditionSkipToOrder | ( | VehicleOrderID | order_id | ) | [inline] |
Get the order to skip to.
Definition at line 174 of file order_base.h.
References flags.
Referenced by CmdModifyOrder(), CmdMoveOrder(), DeleteOrder(), and InsertOrder().
void Order::SetConditionValue | ( | uint16 | value | ) | [inline] |
Set the value to base the skip on.
Definition at line 176 of file order_base.h.
Referenced by CmdModifyOrder().
void Order::SetConditionVariable | ( | OrderConditionVariable | condition_variable | ) | [inline] |
Set variable we have to compare.
Definition at line 170 of file order_base.h.
Referenced by CmdModifyOrder().
void Order::SetDepotActionType | ( | OrderDepotActionFlags | depot_service_type | ) | [inline] |
Set what we are going to do in the depot.
Definition at line 168 of file order_base.h.
Referenced by CmdModifyOrder(), CmdOrderRefit(), ConvertFromOldSavegame(), MakeGoToDepot(), OrdersWindow::OrderClick_NearestDepot(), and Vehicle::SendToDepot().
void Order::SetDepotOrderType | ( | OrderDepotTypeFlags | depot_order_type | ) | [inline] |
Set the cause to go to the depot.
Definition at line 166 of file order_base.h.
Referenced by CmdModifyOrder(), CmdOrderRefit(), ConvertFromOldSavegame(), MakeGoToDepot(), and Vehicle::SendToDepot().
void Order::SetDestination | ( | DestinationID | destination | ) | [inline] |
Sets the destination of this order.
destination | the new destination of the order. |
Definition at line 104 of file order_base.h.
References dest.
Referenced by DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Big_Ufo_Destroyer(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), ReleaseDisastersTargetingIndustry(), ReleaseDisastersTargetingVehicle(), and UpdateWaypointOrder().
void Order::SetLoadType | ( | OrderLoadFlags | load_type | ) | [inline] |
Set how the consist must be loaded.
Definition at line 158 of file order_base.h.
Referenced by AfterLoadGame(), CancelLoadingDueToDeletedOrder(), CmdModifyOrder(), and ConvertFromOldSavegame().
void Order::SetNonStopType | ( | OrderNonStopFlags | non_stop_type | ) | [inline] |
Set whether we must stop at stations or not.
Definition at line 162 of file order_base.h.
Referenced by AfterLoadGame(), Vehicle::BeginLoading(), CancelLoadingDueToDeletedOrder(), CmdModifyOrder(), ConvertFromOldSavegame(), and MakeGoToDepot().
void Order::SetRefit | ( | CargoID | cargo, | |
byte | subtype = 0 | |||
) |
Make this depot/station order also a refit order.
cargo | the cargo type to change to. | |
subtype | the subtype to change to. |
Definition at line 165 of file order_cmd.cpp.
References refit_cargo, and refit_subtype.
Referenced by AfterLoadGame(), CmdModifyOrder(), CmdOrderRefit(), and MakeGoToDepot().
void Order::SetStopLocation | ( | OrderStopLocation | stop_location | ) | [inline] |
Set where we must stop at the platform.
Definition at line 164 of file order_base.h.
Referenced by AfterLoadGame(), CmdModifyOrder(), and ConvertFromOldSavegame().
void Order::SetUnloadType | ( | OrderUnloadFlags | unload_type | ) | [inline] |
Set how the consist must be unloaded.
Definition at line 160 of file order_base.h.
Referenced by AfterLoadGame(), CmdModifyOrder(), and ConvertFromOldSavegame().
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 2252 of file order_cmd.cpp.
References dest, GetDepotOrderType(), GetNonStopType(), IsType(), Vehicle::last_station_visited, ODTFB_PART_OF_ORDERS, and ONSF_NO_STOP_AT_DESTINATION_STATION.
Referenced by CheckNextTrainTile(), Train::GetCurrentMaxSpeed(), and Vehicle::ShowVisualEffect().
struct SaveLoad* GetVehicleDescription | ( | VehicleType | vt | ) | [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 553 of file vehicle_sl.cpp.
void Load_VEHS | ( | ) | [friend] |
Loading of ancient vehicles.
Definition at line 857 of file vehicle_sl.cpp.