mirror of https://github.com/OpenTTD/OpenTTD
(svn r25609) -Fix [FS#5216]: under certain circumstances a track type change would make the end-of-line-is-red setting ineffective
parent
740643f2b2
commit
f178899609
|
@ -223,6 +223,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.
|
* AddNewNode() - called by Tderived::PfFollowNode() for each child node.
|
||||||
* Nodes are evaluated here and added into open list
|
* Nodes are evaluated here and added into open list
|
||||||
|
|
|
@ -212,7 +212,8 @@ public:
|
||||||
/* we have a red signal in our direction
|
/* we have a red signal in our direction
|
||||||
* was it first signal which is two-way? */
|
* was it first signal which is two-way? */
|
||||||
if (!IsPbsSignal(sig_type) && Yapf().TreatFirstRedTwoWaySignalAsEOL() && n.flags_u.flags_s.m_choice_seen && has_signal_against && n.m_num_signals_passed == 0) {
|
if (!IsPbsSignal(sig_type) && Yapf().TreatFirstRedTwoWaySignalAsEOL() && n.flags_u.flags_s.m_choice_seen && has_signal_against && n.m_num_signals_passed == 0) {
|
||||||
/* yes, the first signal is two-way red signal => DEAD END */
|
/* yes, the first signal is two-way red signal => DEAD END. Prune this branch... */
|
||||||
|
Yapf().PruneIntermediateNodeBranch();
|
||||||
n.m_segment->m_end_segment_reason |= ESRB_DEAD_END;
|
n.m_segment->m_end_segment_reason |= ESRB_DEAD_END;
|
||||||
Yapf().m_stopped_on_first_two_way_signal = true;
|
Yapf().m_stopped_on_first_two_way_signal = true;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue