summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-18 20:48:38 +0000
committerrubidium <rubidium@openttd.org>2010-08-18 20:48:38 +0000
commit926594b599e76886fd877e953036918687418b0c (patch)
treedb13aaa32a38c15aa14f64f4d01a0962889f9c0e /src/train_cmd.cpp
parent04d6648c5efd89a32669a17d6ad2711c719820d9 (diff)
downloadopenttd-926594b599e76886fd877e953036918687418b0c.tar.xz
(svn r20547) -Change: the way order backups are performed. Now restoring an order doesn't require up to 765 commands.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 420aa1b20..ece8cb5cf 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -41,6 +41,7 @@
#include "engine_base.h"
#include "engine_func.h"
#include "newgrf.h"
+#include "order_backup.h"
#include "table/strings.h"
#include "table/train_cmd.h"
@@ -1325,9 +1326,10 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
* - data = 0: only sell the single dragged wagon/engine (and any belonging rear-engines)
* - data = 1: sell the vehicle and all vehicles following it in the chain
* if the wagon is dragged, don't delete the possibly belonging rear-engine to some front
+ * @param user the user for the order backup.
* @return the cost of this operation or an error
*/
-CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data)
+CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint32 user)
{
/* Check if we deleted a vehicle window */
Window *w = NULL;
@@ -1381,6 +1383,8 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data)
/* If we deleted a window then open a new one for the 'new' train */
if (IsLocalCompany() && w != NULL) ShowVehicleViewWindow(new_head);
+ } else if (v->IsPrimaryVehicle() && data & (MAKE_ORDER_BACKUP_FLAG >> 16)) {
+ OrderBackup::Backup(v, user);
}
/* We need to update the information about the train. */