30 if (CleaningPool())
return;
32 Order *o = this->orders;
62 FOR_VEHICLE_ORDERS(v, order) {
78 if (this->
clone != NULL) {
109 if (ob->
user == user)
delete ob;
177 if (ob->
user != user)
continue;
196 #ifdef ENABLE_NETWORK 205 if (ob->
user != user)
continue;
246 if (ob->
clone == v) {
250 if (ob->
clone == NULL)
delete ob;
267 if (ot == OT_IMPLICIT || (
IsHangarTile(ob->
tile) && ot == OT_GOTO_DEPOT)) ot = OT_GOTO_STATION;
268 if (ot == type && order->GetDestination() == destination) {
clear the order backup of a given user/tile
bool _networking
are we in networking mode?
Maps accessors for stations.
Order * orders
The actual orders if the vehicle was not a clone.
static void ResetUser(uint32 user)
Reset an user's OrderBackup if needed.
uint32 user
The user that requested the backup.
OrderList * list
Pointer to the order list for this vehicle.
TileIndex tile
Tile of the depot where the order was changed.
Tindex index
Index of this pool item.
clone (and share) an order
Common return value for all commands.
Servers always have this ID.
Order * next
Pointer to next order. If NULL, end of list.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
static void ResetOfUser(TileIndex tile, uint32 user)
Reset an OrderBackup given a tile and user.
const Vehicle * clone
Vehicle this vehicle was a clone of.
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...
Some methods of Pool are placed here in order to reduce compilation time and binary size...
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
#define FOR_ALL_ORDER_BACKUPS(var)
Iterator over all order backups.
DoCommandFlag
List of flags for a command.
ClientID _network_own_client_id
Our client identifier.
Definition of base types and functions in a cross-platform compatible way.
void CopyConsistPropertiesFrom(const BaseConsist *src)
Copy properties of other BaseConsist.
A number of safeguards to prevent using unsafe methods.
uint16 GroupID
Type for all group identifiers.
CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only)
void UpdateRealOrderIndex()
Skip implicit orders until cur_real_order_index is a non-implicit order.
OrderBackupPool _order_backup_pool("BackupOrder")
The pool with order backups.
Functions related to order backups.
TileIndex tile
Current tile index.
Basic functions/variables used all over the place.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Base class for all pools.
Station list; Window numbers:
static void Reset(TileIndex tile=INVALID_TILE, bool from_gui=true)
Reset the OrderBackups from GUI/game logic.
static void RemoveOrder(OrderType type, DestinationID destination)
Removes an order from all vehicles.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
execute the given command
static const GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Clear an OrderBackup.
void DoRestore(Vehicle *v)
Restore the data of this order to the given vehicle.
static void ClearVehicle(const Vehicle *v)
Clear/update the (clone) vehicle from an order backup.
Base class for all vehicles.
uint32 TileIndex
The index/ID of a Tile.
Send the vehicle to the nearest depot.
static void ClearGroup(GroupID group)
Clear the group of all backups having this group ID.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() ...
void AssignOrder(const Order &other)
Assign data to an order (from another order) This function makes sure that the index is maintained co...
Functions related to commands.
Network functions used by other parts of OpenTTD.
bool _network_server
network-server is active
OrderBackup()
Creation for savegame restoration.
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
static bool IsHangarTile(TileIndex t)
Is tile t an hangar tile?
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
GroupID group
The group the vehicle was part of.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Window functions not directly related to making/drawing windows.
static void Restore(Vehicle *v, uint32 user)
Restore the data of this order to the given vehicle.
static void Backup(const Vehicle *v, uint32 user)
Create an order backup for the given vehicle.
union Vehicle::@46 orders
The orders currently assigned to the vehicle.
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the sam...
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
GroupID group_id
Index of group Pool array.