From 3c55250cd6287e46b9dce114f853e48cbbf7a30f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 9 Sep 2021 22:48:52 +0100 Subject: [PATCH] Fix last station visited not being set when reservation ends at target Long reserve and subsequent routing restrictions immediately beyond the reservation were evaluated without the last station visited being updated to reflect that the target station was already reached. --- src/train_cmd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 9abbc60794..c73d7ff3a8 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -4304,6 +4304,9 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, if (got_reservation) { if (v->current_order.IsBaseStationOrder() && HasStationTileRail(res_dest.tile) && v->current_order.GetDestination() == GetStationIndex(res_dest.tile)) { + if (v->current_order.ShouldStopAtStation(v, v->current_order.GetDestination(), v->current_order.IsType(OT_GOTO_WAYPOINT))) { + v->last_station_visited = v->current_order.GetDestination(); + } orders.SwitchToNextOrder(true); } if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) {