OrderBackup Struct Reference

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>

Inheritance diagram for OrderBackup:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_order_backup_pool >

Public Member Functions

 ~OrderBackup ()
 Free everything that is allocated.

Static Public Member Functions

static void Backup (const Vehicle *v, uint32 user)
 Create an order backup for the given vehicle.
static void Restore (Vehicle *v, uint32 user)
 Restore the data of this order to the given vehicle.
static void ResetOfUser (TileIndex tile, uint32 user)
 Reset an OrderBackup given a tile and user.
static void ResetUser (uint32 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.

Private Member Functions

 OrderBackup ()
 Creation for savegame restoration.
 OrderBackup (const Vehicle *v, uint32 user)
 Create an order backup for the given vehicle.
void DoRestore (Vehicle *v)
 Restore the data of this order to the given vehicle.

Private Attributes

uint32 user
 The user that requested the backup.
TileIndex tile
 Tile of the depot where the order was changed.
GroupID group
 The group the vehicle was part of.
Date service_interval
 The service interval of the vehicle.
char * name
 The custom name of the vehicle.
const Vehicleclone
 Vehicle this vehicle was a clone of.
VehicleOrderID orderindex
 The order-index the vehicle had.
Orderorders
 The actual orders if the vehicle was not a clone.

Friends

struct SaveLoadGetOrderBackupDescription ()
 Saving and loading of order backups.
void Load_BKOR ()
 Creating empty orders upon savegame loading.

Detailed Description

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 38 of file order_backup.h.


Constructor & Destructor Documentation

OrderBackup::OrderBackup (  )  [inline, private]

Creation for savegame restoration.

Definition at line 53 of file order_backup.h.

Referenced by Backup().

OrderBackup::OrderBackup ( const Vehicle v,
uint32  user 
) [private]

Create an order backup for the given vehicle.

Parameters:
v The vehicle to make a backup of.
user The user that is requesting the backup.

Definition at line 37 of file order_backup.cpp.

References Order::AssignOrder(), clone, Vehicle::cur_order_index, Vehicle::FirstShared(), group, Vehicle::group_id, Vehicle::IsOrderListShared(), name, Vehicle::name, Order::next, Vehicle::NextShared(), orderindex, orders, service_interval, Vehicle::tile, and tile.

OrderBackup::~OrderBackup (  ) 

Free everything that is allocated.

Definition at line 23 of file order_backup.cpp.

References Order::next.


Member Function Documentation

void OrderBackup::Backup ( const Vehicle v,
uint32  user 
) [static]

Create an order backup for the given vehicle.

Parameters:
v The vehicle to make a backup of.
user The user that is requesting the backup.
Note:
Will automatically remove any previous backups of this user.

Definition at line 87 of file order_backup.cpp.

References OrderBackup(), and user.

Referenced by CmdSellRailWagon(), and CmdSellVehicle().

void OrderBackup::ClearGroup ( GroupID  group  )  [static]

Clear the group of all backups having this group ID.

Parameters:
group The group to clear.

Definition at line 180 of file order_backup.cpp.

References DEFAULT_GROUP, and group.

Referenced by CmdDeleteGroup().

void OrderBackup::ClearVehicle ( const Vehicle v  )  [static]

Clear/update the (clone) vehicle from an order backup.

Parameters:
v The vehicle to clear.
Precondition:
v != NULL
Note:
If it is not possible to set another vehicle as clone "example", then this backed up order will be removed.

Definition at line 188 of file order_backup.cpp.

References clone, Vehicle::FirstShared(), and Vehicle::NextShared().

Referenced by Vehicle::PreDestructor().

void OrderBackup::DoRestore ( Vehicle v  )  [private]
void OrderBackup::Reset ( TileIndex  tile = INVALID_TILE,
bool  from_gui = true 
) [static]

Reset the OrderBackups from GUI/game logic.

Parameters:
tile 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 148 of file order_backup.cpp.

References _network_server, _networking, CLIENT_ID_SERVER, CMD_CLEAR_ORDER_BACKUP, DoCommandPInternal(), INVALID_TILE, tile, and user.

Referenced by RemoveAirport(), and Depot::~Depot().

void OrderBackup::ResetOfUser ( TileIndex  tile,
uint32  user 
) [static]

Reset an OrderBackup given a tile and user.

Parameters:
tile The tile associated with the OrderBackup.
user The user associated with the OrderBackup.
Note:
Must not be used from the GUI!

Definition at line 109 of file order_backup.cpp.

References INVALID_TILE, tile, and user.

Referenced by CmdClearOrderBackup().

void OrderBackup::ResetUser ( uint32  user  )  [static]

Reset an user's OrderBackup if needed.

Parameters:
user The user associated with the OrderBackup.
Precondition:
_network_server.
Note:
Must not be used from a command.

Definition at line 134 of file order_backup.cpp.

References _network_server, CMD_CLEAR_ORDER_BACKUP, DoCommandP(), and user.

Referenced by ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler().

void OrderBackup::Restore ( Vehicle v,
uint32  user 
) [static]

Restore the data of this order to the given vehicle.

Parameters:
v The vehicle to restore to.
user The user that built the vehicle, thus wants to restore.
Note:
After restoration the backup will automatically be removed.

Definition at line 98 of file order_backup.cpp.

References DoRestore(), tile, Vehicle::tile, and user.

Referenced by CmdBuildVehicle().


The documentation for this struct was generated from the following files:

Generated on Fri Dec 31 17:16:44 2010 for OpenTTD by  doxygen 1.6.1