|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
31 if (CleaningPool())
return;
33 Order *o = this->orders;
34 while (o !=
nullptr) {
78 if (this->
clone !=
nullptr) {
111 if (ob->user ==
user)
delete ob;
127 if (v->
tile != ob->tile || ob->user !=
user)
continue;
174 if (ob->user !=
user)
continue;
197 if (from_gui && ob->user !=
user)
continue;
234 assert(v !=
nullptr);
236 if (ob->clone == v) {
240 if (ob->clone ==
nullptr)
delete ob;
256 for (
Order *order = ob->orders; order !=
nullptr; order = order->
next) {
259 if (ot == OT_GOTO_DEPOT && hangar && !
IsHangarTile(ob->tile))
continue;
260 if (ot == OT_IMPLICIT || (
IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT && !hangar)) ot = OT_GOTO_STATION;
261 if (ot == type && order->GetDestination() == destination) {
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
The information about a vehicle list.
bool _network_server
network-server is active
std::string name
Name of vehicle.
Tindex index
Index of this pool item.
GroupID group_id
Index of group Pool array.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
void AssignOrder(const Order &other)
Assign data to an order (from another order) This function makes sure that the index is maintained co...
const Vehicle * clone
Vehicle this vehicle was a clone of.
static void ClearVehicle(const Vehicle *v)
Clear/update the (clone) vehicle from an order backup.
OrderBackupPool _order_backup_pool("BackupOrder")
The pool with order backups.
@ DC_EXEC
execute the given command
DoCommandFlag
List of flags for a command.
Defines the traits of a command.
void UpdateRealOrderIndex()
Skip implicit orders until cur_real_order_index is a non-implicit order.
static void ResetUser(uint32_t user)
Reset an user's OrderBackup if needed.
IterateWrapper Orders() const
Returns an iterable ensemble of orders of a vehicle.
Common return value for all commands.
TileIndex tile
Current tile index.
CommandCost CmdClearOrderBackup(DoCommandFlag flags, TileIndex tile, ClientID user_id)
Clear an OrderBackup.
@ ODATFB_NEAREST_DEPOT
Send the vehicle to the nearest depot.
static const GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
bool _networking
are we in networking mode?
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
static void Reset(TileIndex tile=INVALID_TILE, bool from_gui=true)
Reset the OrderBackups from GUI/game logic.
ClientID _network_own_client_id
Our client identifier.
void DoRestore(Vehicle *v)
Restore the data of this order to the given vehicle.
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Base class for all pools.
ClientID
'Unique' identifier to be given to clients
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
static void ResetOfUser(TileIndex tile, uint32_t user)
Reset an OrderBackup given a tile and user.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Order * orders
The actual orders if the vehicle was not a clone.
TileIndex tile
Tile of the depot where the order was changed.
static void Restore(Vehicle *v, uint32_t user)
Restore the data of this order to the given vehicle.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static void ClearGroup(GroupID group)
Clear the group of all backups having this group ID.
uint16_t GroupID
Type for all group identifiers.
static void RemoveOrder(OrderType type, DestinationID destination, bool hangar)
Removes an order from all vehicles.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
uint32_t user
The user that requested the backup.
GroupID group
The group the vehicle was part of.
static void Backup(const Vehicle *v, uint32_t user)
Create an order backup for the given vehicle.
OrderBackup()
Creation for savegame restoration.
bool IsUniqueVehicleName(const std::string &name)
Test if a name is unique among vehicle names.
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the sam...
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
OrderList * orders
Pointer to the order list for this vehicle.
void CopyConsistPropertiesFrom(const BaseConsist *src)
Copy properties of other BaseConsist.
@ WC_STATION_LIST
Station list; Window numbers:
Order * next
Pointer to next order. If nullptr, end of list.
@ CLIENT_ID_SERVER
Servers always have this ID.
bool IsHangarTile(Tile t)
Is tile t an hangar tile?