summaryrefslogtreecommitdiff
path: root/src/order_backup.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-18 18:52:16 +0000
committerrubidium <rubidium@openttd.org>2010-08-18 18:52:16 +0000
commit019878118d11a6596eeab608c361dfea06c3f1ff (patch)
tree4675f56eaa3968827b3a98a1dd924f1de7c4bd13 /src/order_backup.h
parente2422945301452421ede848aa67a2ff47ed03d13 (diff)
downloadopenttd-019878118d11a6596eeab608c361dfea06c3f1ff.tar.xz
(svn r20545) -Codechange: make sure an OrderBackup gets cleared when the depot it belongs to gets removed, the depot window gets closed or when another vehicle gets sold in a depot
Diffstat (limited to 'src/order_backup.h')
-rw-r--r--src/order_backup.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/order_backup.h b/src/order_backup.h
index 04913c2ac..3d4f81f92 100644
--- a/src/order_backup.h
+++ b/src/order_backup.h
@@ -43,34 +43,41 @@ private:
VehicleOrderID orderindex; ///< The order-index the vehicle had.
Order *orders; ///< The actual orders if the vehicle was not a clone.
-public:
/**
* Create an order backup for the given vehicle.
* @param v The vehicle to make a backup of.
*/
OrderBackup(const Vehicle *v);
+ /**
+ * Restore the data of this order to the given vehicle.
+ * @param v The vehicle to restore to.
+ */
+ void DoRestore(const Vehicle *v);
+
+public:
/** Free everything that is allocated. */
~OrderBackup();
/**
- * Restore the data of this order to the given vehicle.
- * @param v The vehicle to restore to.
- * @note After restoration the backup will automatically be removed.
+ * Create an order backup for the given vehicle.
+ * @param v The vehicle to make a backup of.
+ * @note Will automatically remove any previous backups of this user.
*/
- void RestoreTo(const Vehicle *v);
+ static void Backup(const Vehicle *v);
/**
- * Get the order backup associated with a given tile.
- * @param t The tile to get the order backup for.
- * @return The order backup, or NULL if it doesn't exist.
+ * Restore the data of this order to the given vehicle.
+ * @param v The vehicle to restore to.
+ * @note After restoration the backup will automatically be removed.
*/
- static OrderBackup *GetByTile(TileIndex t);
+ static void Restore(const Vehicle *v);
/**
* Reset the OrderBackups.
+ * @param tile The tile of the order backup.
*/
- static void Reset();
+ static void Reset(TileIndex tile = INVALID_TILE);
/**
* Clear the group of all backups having this group ID.