summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2008-10-31 16:46:34 +0000
committermichi_cc <michi_cc@openttd.org>2008-10-31 16:46:34 +0000
commita4548a4b9be2ce4ece5b376374e519bfae78d403 (patch)
tree5fb05aa24edb4aa495283e7a364019ddef317e3e /src/train_cmd.cpp
parent4661917f644295c3af3bffe31e3330d566a48855 (diff)
downloadopenttd-a4548a4b9be2ce4ece5b376374e519bfae78d403.tar.xz
(svn r14550) -Fix [FS#2391]: Don't assert on path look-ahead when processing a not-part-of-orders depot-order.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 67245fe26..96fd4dd07 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2926,8 +2926,12 @@ static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir
VehicleOrderSaver orders(v);
/* If the current tile is the destination of the current order and
- * a reservation was requested, advance to the next order. */
- if (v->tile == v->dest_tile || (v->current_order.IsType(OT_GOTO_STATION) && IsRailwayStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile))) {
+ * a reservation was requested, advance to the next order.
+ * Don't advance on a depot order as depots are always safe end points
+ * for a path and no look-ahead is necessary. This also avoids a
+ * problem with depot orders not part of the order list when the
+ * order list itself is empty. */
+ if (!v->current_order.IsType(OT_GOTO_DEPOT) && (v->tile == v->dest_tile || (v->current_order.IsType(OT_GOTO_STATION) && IsRailwayStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile)))) {
orders.SwitchToNextOrder();
}