summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-20 15:30:21 +0000
committerrubidium <rubidium@openttd.org>2010-08-20 15:30:21 +0000
commitf3864181b66f7a083679d8e4f08da8a37b6b1fa3 (patch)
treeac18295c73e78d57158fde79813e44d641f03859
parent03ab15893590a53616e2d5f01570317c4fd20866 (diff)
downloadopenttd-f3864181b66f7a083679d8e4f08da8a37b6b1fa3.tar.xz
(svn r20580) -Fix [FS#4039]: go via station and go via waypoint behaved differently when a train went back to the same (unordered) station again
-rw-r--r--src/order_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 59e5c37f0..38096e877 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1680,11 +1680,15 @@ bool ProcessOrders(Vehicle *v)
*/
bool may_reverse = v->current_order.IsType(OT_NOTHING);
- /* Check if we've reached a non-stop station.. */
+ /* Check if we've reached a 'via' destination. */
if (((v->current_order.IsType(OT_GOTO_STATION) && (v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) || v->current_order.IsType(OT_GOTO_WAYPOINT)) &&
IsTileType(v->tile, MP_STATION) &&
v->current_order.GetDestination() == GetStationIndex(v->tile)) {
- if (v->current_order.IsType(OT_GOTO_STATION)) v->last_station_visited = v->current_order.GetDestination();
+ /* We set the last visited station here because we do not want
+ * the train to stop at this 'via' station if the next order
+ * is a no-non-stop order; in that case not setting the last
+ * visited station will cause the vehicle to still stop. */
+ v->last_station_visited = v->current_order.GetDestination();
UpdateVehicleTimetable(v, true);
v->IncrementOrderIndex();
}