diff options
author | rubidium <rubidium@openttd.org> | 2013-07-14 09:21:46 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-07-14 09:21:46 +0000 |
commit | f178899609bb30284e40b1a3f5246ce44cfbf569 (patch) | |
tree | f665735517f7f1a0238a07a700cb9f780a6362c0 /src/pathfinder/yapf/yapf_base.hpp | |
parent | 740643f2b273e98b11f76815efe9f454b3b7e76d (diff) | |
download | openttd-f178899609bb30284e40b1a3f5246ce44cfbf569.tar.xz |
(svn r25609) -Fix [FS#5216]: under certain circumstances a track type change would make the end-of-line-is-red setting ineffective
Diffstat (limited to 'src/pathfinder/yapf/yapf_base.hpp')
-rw-r--r-- | src/pathfinder/yapf/yapf_base.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp index f63dcf04a..0f88d058e 100644 --- a/src/pathfinder/yapf/yapf_base.hpp +++ b/src/pathfinder/yapf/yapf_base.hpp @@ -224,6 +224,21 @@ public: } /** + * In some cases an intermediate node branch should be pruned. + * The most prominent case is when a red EOL signal is encountered, but + * there was a segment change (e.g. a rail type change) before that. If + * the branch would not be pruned, the rail type change location would + * remain the best intermediate node, and thus the vehicle would still + * go towards the red EOL signal. + */ + void PruneIntermediateNodeBranch() + { + while (Yapf().m_pBestIntermediateNode != NULL && (Yapf().m_pBestIntermediateNode->m_segment->m_end_segment_reason & ESRB_CHOICE_FOLLOWS) == 0) { + Yapf().m_pBestIntermediateNode = Yapf().m_pBestIntermediateNode->m_parent; + } + } + + /** * AddNewNode() - called by Tderived::PfFollowNode() for each child node. * Nodes are evaluated here and added into open list */ |