Mercurial > hg > openttd
diff src/waypoint.cpp @ 7704:2732cf9f8b9b draft
(svn r11238) -Fix [FS#1316]: the orders of trains going to a waypoint where not updated when the waypoint would be moved.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 09 Oct 2007 21:29:34 +0000 (2007-10-09) |
parents | 96d510452b4d |
children | 013f54f32e5e |
line wrap: on
line diff
--- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -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; }