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.
This commit is contained in:
Jonathan G Rennison 2021-09-09 22:48:52 +01:00
parent afd66c1631
commit 3c55250cd6

View File

@ -4304,6 +4304,9 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
if (got_reservation) { if (got_reservation) {
if (v->current_order.IsBaseStationOrder() && HasStationTileRail(res_dest.tile) && v->current_order.GetDestination() == GetStationIndex(res_dest.tile)) { 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); orders.SwitchToNextOrder(true);
} }
if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) { if (_settings_game.vehicle.train_braking_model == TBM_REALISTIC) {