summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-09 21:29:34 +0000
committerrubidium <rubidium@openttd.org>2007-10-09 21:29:34 +0000
commit77020e255b530faa018efb1b30a74f86def04f01 (patch)
treebf3b43628fab4944faecf2344213d150d46b67f5 /src
parent6cebf4aa53a4eafb79b8ea9969aafda44d4fb0cd (diff)
downloadopenttd-77020e255b530faa018efb1b30a74f86def04f01.tar.xz
(svn r11238) -Fix [FS#1316]: the orders of trains going to a waypoint where not updated when the waypoint would be moved.
Diffstat (limited to 'src')
-rw-r--r--src/waypoint.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 52eed75ed..34e6a7d8b 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -197,7 +197,20 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
wp->string = STR_NULL;
wp->town_cn = 0;
} else if (flags & DC_EXEC) {
- /* move existing (recently deleted) waypoint to the new location */
+ /* Move existing (recently deleted) waypoint to the new location */
+
+ /* First we update the destination for all vehicles that
+ * have the old waypoint in their orders. */
+ Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_TRAIN &&
+ v->First() == v &&
+ v->current_order.type == OT_GOTO_WAYPOINT &&
+ v->dest_tile == wp->xy) {
+ v->dest_tile = tile;
+ }
+ }
+
RedrawWaypointSign(wp);
wp->xy = tile;
}