summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-15 22:40:54 +0000
committerrubidium <rubidium@openttd.org>2011-01-15 22:40:54 +0000
commit7645c5ac43b8b16611fdd169bc01fb5e9d2d43b9 (patch)
tree0424ba3695ea115c103c3e94c656fd9085322384 /src/pathfinder
parent6e4dd5615878c658cf687a73dc1990f9e903df86 (diff)
downloadopenttd-7645c5ac43b8b16611fdd169bc01fb5e9d2d43b9.tar.xz
(svn r21815) -Fix [FS#3908]: [YAPF] Apply a pathfinder penalty for back of one-way path signals so those aren't preferred over other possibilities
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index 5d00adddb..0cee47699 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -515,10 +515,13 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
TILE next(tf_local.m_new_tile, (Trackdir)FindFirstBit2x64(tf_local.m_new_td_bits));
if (TrackFollower::DoTrackMasking() && IsTileType(next.tile, MP_RAILWAY)) {
- if ((HasSignalOnTrackdir(next.tile, next.td) && IsPbsSignal(GetSignalType(next.tile, TrackdirToTrack(next.td)))) ||
- (HasSignalOnTrackdir(next.tile, ReverseTrackdir(next.td)) && GetSignalType(next.tile, TrackdirToTrack(next.td)) == SIGTYPE_PBS_ONEWAY)) {
+ if (HasSignalOnTrackdir(next.tile, next.td) && IsPbsSignal(GetSignalType(next.tile, TrackdirToTrack(next.td)))) {
/* Possible safe tile. */
end_segment_reason |= ESRB_SAFE_TILE;
+ } else if (HasSignalOnTrackdir(next.tile, ReverseTrackdir(next.td)) && GetSignalType(next.tile, TrackdirToTrack(next.td)) == SIGTYPE_PBS_ONEWAY) {
+ /* Possible safe tile, but not so good as it's the back of a signal... */
+ end_segment_reason |= ESRB_SAFE_TILE | ESRB_DEAD_END;
+ extra_cost += Yapf().PfGetSettings().rail_lastred_exit_penalty;
}
}