|
OpenTTD Source 20260206-master-g4d4e37dbf1
|
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the same depot. More...
#include <order_backup.h>
Static Public Member Functions | |
| static void | Backup (const Vehicle *v, uint32_t user) |
| Create an order backup for the given vehicle. | |
| static void | Restore (Vehicle *v, uint32_t user) |
| Restore the data of this order to the given vehicle. | |
| static void | ResetOfUser (TileIndex tile, uint32_t user) |
| Reset an OrderBackup given a tile and user. | |
| static void | ResetUser (uint32_t user) |
| Reset an user's OrderBackup if needed. | |
| static void | Reset (TileIndex tile=INVALID_TILE, bool from_gui=true) |
| Reset the OrderBackups from GUI/game logic. | |
| static void | ClearGroup (GroupID group) |
| Clear the group of all backups having this group ID. | |
| static void | ClearVehicle (const Vehicle *v) |
| Clear/update the (clone) vehicle from an order backup. | |
| static void | RemoveOrder (OrderType type, DestinationID destination, bool hangar) |
| Removes an order from all vehicles. | |
Private Member Functions | |
| void | DoRestore (Vehicle *v) |
| Restore the data of this order to the given vehicle. | |
| OrderBackup (OrderBackupID index) | |
| Create an order backup for savegame loading. | |
| OrderBackup (OrderBackupID index, const Vehicle *v, uint32_t user) | |
| Create an order backup for the given vehicle. | |
Private Attributes | |
| uint32_t | user = 0 |
| The user that requested the backup. | |
| TileIndex | tile = INVALID_TILE |
| Tile of the depot where the order was changed. | |
| GroupID | group = GroupID::Invalid() |
| The group the vehicle was part of. | |
| const Vehicle * | clone = nullptr |
| Vehicle this vehicle was a clone of. | |
| std::vector< Order > | orders |
| The actual orders if the vehicle was not a clone. | |
| uint32_t | old_order_index = 0 |
| friend | OrderBackupPoolItem |
| Loading of order backups. | |
Friends | |
| struct | BKORChunkHandler |
| Creating empty orders upon savegame loading. | |
| template<typename T> | |
| class | SlOrders |
| SaveLoadTable | GetOrderBackupDescription () |
| Saving and loading of order backups. | |
Additional Inherited Members | |
| Public Member Functions inherited from BaseConsist | |
| void | CopyConsistPropertiesFrom (const BaseConsist *src) |
| Copy properties of other BaseConsist. | |
| void | ResetDepotUnbunching () |
| Resets all the data used for depot unbunching. | |
| Data Fields inherited from BaseConsist | |
| std::string | name {} |
| Name of vehicle. | |
| TimerGameTick::Ticks | current_order_time {} |
| How many ticks have passed since this order started. | |
| TimerGameTick::Ticks | lateness_counter {} |
| How many ticks late (or early if negative) this vehicle is. | |
| TimerGameTick::TickCounter | timetable_start {} |
| At what tick of TimerGameTick::counter the vehicle should start its timetable. | |
| TimerGameTick::TickCounter | depot_unbunching_last_departure {} |
| When the vehicle last left its unbunching depot. | |
| TimerGameTick::TickCounter | depot_unbunching_next_departure {} |
| When the vehicle will next try to leave its unbunching depot. | |
| TimerGameTick::Ticks | round_trip_time |
| How many ticks for a single circumnavigation of the orders. | |
| uint16_t | service_interval = 0 |
| The interval for (automatic) servicing; either in days or %. | |
| VehicleOrderID | cur_real_order_index = 0 |
| The index to the current real (non-implicit) order. | |
| VehicleOrderID | cur_implicit_order_index = 0 |
| The index to the current implicit order. | |
| VehicleFlags | vehicle_flags {} |
| Used for gradual loading and other miscellaneous things (. | |
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the same depot.
Definition at line 35 of file order_backup.h.
|
private |
Create an order backup for savegame loading.
| index | The index of the order backup pool. |
Definition at line 36 of file order_backup.cpp.
References _order_backup_pool.
Referenced by Backup(), ClearGroup(), ClearVehicle(), GetOrderBackupDescription, RemoveOrder(), Reset(), ResetOfUser(), ResetUser(), and Restore().
|
private |
Create an order backup for the given vehicle.
| index | The index of the order backup pool. |
| v | The vehicle to make a backup of. |
| user | The user that is requesting the backup. |
Definition at line 47 of file order_backup.cpp.
References _order_backup_pool, clone, BaseConsist::CopyConsistPropertiesFrom(), Vehicle::FirstShared(), group, Vehicle::IsOrderListShared(), Vehicle::NextShared(), orders, tile, and user.
|
static |
Create an order backup for the given vehicle.
| v | The vehicle to make a backup of. |
| user | The user that is requesting the backup. |
Definition at line 95 of file order_backup.cpp.
References OrderBackup(), and user.
Referenced by CmdSellRailWagon(), and CmdSellVehicle().
|
static |
Clear the group of all backups having this group ID.
| group | The group to clear. |
Definition at line 207 of file order_backup.cpp.
References DEFAULT_GROUP, group, and OrderBackup().
Referenced by CmdDeleteGroup().
|
static |
Clear/update the (clone) vehicle from an order backup.
| v | The vehicle to clear. |
Definition at line 221 of file order_backup.cpp.
References Vehicle::FirstShared(), Vehicle::NextShared(), and OrderBackup().
Referenced by Vehicle::PreDestructor().
|
private |
Restore the data of this order to the given vehicle.
| v | The vehicle to restore to. |
Definition at line 65 of file order_backup.cpp.
References clone, BaseConsist::CopyConsistPropertiesFrom(), BaseConsist::cur_implicit_order_index, BaseConsist::cur_real_order_index, Execute, Vehicle::GetNumOrders(), group, InvalidateWindowClassesData(), IsUniqueVehicleName(), BaseConsist::name, orders, Vehicle::orders, Vehicle::UpdateRealOrderIndex(), and WC_STATION_LIST.
|
static |
Removes an order from all vehicles.
Triggers when, say, a station is removed.
| type | The type of the order (OT_GOTO_[STATION|DEPOT|WAYPOINT]). |
| destination | The destination. Can be a StationID, DepotID or WaypointID. |
| hangar | Only used for airports in the destination. When false, remove airport and hangar orders. When true, remove either airport or hangar order. |
Definition at line 242 of file order_backup.cpp.
References Order::GetDepotActionType(), Order::GetDestination(), Order::GetType(), IsHangarTile(), NearestDepot, OrderBackup(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by RemoveOrderFromAllVehicles().
|
static |
Reset the OrderBackups from GUI/game logic.
| t | The tile of the order backup. |
| from_gui | Whether the call came from the GUI, i.e. whether it must be synced over the network. |
Definition at line 176 of file order_backup.cpp.
References _network_own_client_id, _network_server, _networking, CLIENT_ID_SERVER, INVALID_TILE, OrderBackup(), and user.
Referenced by DepotWindow::Close(), RemoveAirport(), and Depot::~Depot().
|
static |
Reset an OrderBackup given a tile and user.
| tile | The tile associated with the OrderBackup. |
| user | The user associated with the OrderBackup. |
Definition at line 129 of file order_backup.cpp.
References INVALID_TILE, OrderBackup(), tile, and user.
Referenced by CmdClearOrderBackup().
|
static |
Reset an user's OrderBackup if needed.
| user | The user associated with the OrderBackup. |
Definition at line 157 of file order_backup.cpp.
References _network_server, OrderBackup(), and user.
Referenced by ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler().
|
static |
Restore the data of this order to the given vehicle.
| v | The vehicle to restore to. |
| user | The user that built the vehicle, thus wants to restore. |
Definition at line 113 of file order_backup.cpp.
References OrderBackup(), Vehicle::tile, and user.
Referenced by CmdBuildVehicle().
|
friend |
Creating empty orders upon savegame loading.
Definition at line 38 of file order_backup.h.
References BKORChunkHandler.
Referenced by BKORChunkHandler.
|
friend |
Saving and loading of order backups.
Definition at line 296 of file order_sl.cpp.
References clone, BaseConsist::cur_implicit_order_index, BaseConsist::cur_real_order_index, BaseConsist::current_order_time, GetOrderBackupDescription, group, BaseConsist::lateness_counter, BaseConsist::name, OrderBackup(), REF_VEHICLE, BaseConsist::service_interval, SL_MAX_VERSION, SL_MIN_VERSION, SLE_CONDREF, SLE_CONDVAR, SLE_CONDVARNAME, SLE_SSTR, SLE_VAR, SLEG_CONDSTRUCTLIST, SLV_176, SLV_180, SLV_192, SLV_69, SLV_ORDERS_OWNED_BY_ORDERLIST, SLV_TIMETABLE_START_TICKS_FIX, tile, BaseConsist::timetable_start, user, and BaseConsist::vehicle_flags.
Referenced by GetOrderBackupDescription.
|
friend |
Definition at line 40 of file order_backup.h.
|
private |
Vehicle this vehicle was a clone of.
Definition at line 46 of file order_backup.h.
Referenced by DoRestore(), GetOrderBackupDescription, and OrderBackup().
|
private |
The group the vehicle was part of.
Definition at line 44 of file order_backup.h.
Referenced by ClearGroup(), DoRestore(), GetOrderBackupDescription, and OrderBackup().
|
private |
Definition at line 48 of file order_backup.h.
|
private |
Loading of order backups.
Definition at line 52 of file order_backup.h.
|
private |
The actual orders if the vehicle was not a clone.
Definition at line 47 of file order_backup.h.
Referenced by DoRestore(), and OrderBackup().
|
private |
Tile of the depot where the order was changed.
Definition at line 43 of file order_backup.h.
Referenced by GetOrderBackupDescription, OrderBackup(), and ResetOfUser().
|
private |
The user that requested the backup.
Definition at line 42 of file order_backup.h.
Referenced by Backup(), GetOrderBackupDescription, OrderBackup(), Reset(), ResetOfUser(), ResetUser(), and Restore().