# HG changeset patch # User rubidium # Date 1191965374 0 # Node ID 74d44b461346f4936d2e5063763d8e88ed96e3b3 # Parent 00ee9637c0a0037e3dc5d665ef20f61e018ee7ec (svn r11238) -Fix [FS#1316]: the orders of trains going to a waypoint where not updated when the waypoint would be moved. diff -r 00ee9637c0a0 -r 74d44b461346 src/waypoint.cpp --- a/src/waypoint.cpp Tue Oct 09 21:11:23 2007 +0000 +++ b/src/waypoint.cpp Tue Oct 09 21:29:34 2007 +0000 @@ -197,7 +197,20 @@ 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; }