(svn r14550) -Fix [FS#2391]: Don't assert on path look-ahead when processing a not-part-of-orders depot-order.
authormichi_cc
Fri, 31 Oct 2008 16:46:34 +0000
changeset 10307 86ce4ec269d4
parent 10306 38e0bf4a820e
child 10308 72ffe5505a38
(svn r14550) -Fix [FS#2391]: Don't assert on path look-ahead when processing a not-part-of-orders depot-order.
src/train_cmd.cpp
--- a/src/train_cmd.cpp	Thu Oct 30 18:27:17 2008 +0000
+++ b/src/train_cmd.cpp	Fri Oct 31 16:46:34 2008 +0000
@@ -2926,8 +2926,12 @@
 	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();
 	}