From e05f4b2fafe3e16f42c9ceb9eecac510306f4e30 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 11 Jul 2020 22:42:59 +0100 Subject: [PATCH] Use front vehicle for vehicle orders in RV YAPF leader check --- src/pathfinder/yapf/yapf_road.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 58b7d74b9d..5ce3776a79 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -355,12 +355,14 @@ static Vehicle * FindVehiclesOnTileProc(Vehicle *v, void *_data) { FindVehiclesOnTileProcData *data = (FindVehiclesOnTileProcData*)(_data); - if (data->origin_vehicle == v) { + const Vehicle *front = v->First(); + + if (data->origin_vehicle == front) { return nullptr; } /* only consider vehicles going to the same station as us */ - if (!v->current_order.IsType(OT_GOTO_STATION) || data->origin_vehicle->current_order.GetDestination() != v->current_order.GetDestination()) { + if (!front->current_order.IsType(OT_GOTO_STATION) || data->origin_vehicle->current_order.GetDestination() != front->current_order.GetDestination()) { return nullptr; }