From 63fda2f16ed50822016368ac35c0e0da2aa2b51a Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 27 Mar 2021 18:32:14 +0000 Subject: [PATCH] YAPF: Add penalty when reversing at waypoint which is already reserved --- src/pathfinder/yapf/yapf_costrail.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index 81966b29c3..d5f7c04744 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -599,6 +599,10 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th !IsWaitingPositionFree(v, t, td, _settings_game.pf.forbid_90_deg)) { extra_cost += Yapf().PfGetSettings().rail_lastred_penalty; } + + if (v->current_order.GetWaypointFlags() & OWF_REVERSE && HasStationReservation(cur.tile)) { + extra_cost += Yapf().PfGetSettings().rail_pbs_station_penalty * 4; + } } /* Waypoint is also a good reason to finish. */ end_segment_reason |= ESRB_WAYPOINT;