--- a/yapf/yapf_costrail.hpp Fri Aug 10 17:49:29 2007 +0000
+++ b/yapf/yapf_costrail.hpp Fri Aug 10 17:53:12 2007 +0000
@@ -193,6 +193,7 @@
RailType rail_type = GetTileRailType(tile, trackdir);
bool target_seen = Yapf().PfDetectDestination(tile, trackdir);
+ bool end_by_target_seen = false;
if (tf.m_is_station) {
// station tiles have an extra penalty
@@ -210,6 +211,7 @@
// finish if we have reached the destination
if (target_seen) {
+ end_by_target_seen = true;
break;
}
@@ -340,7 +342,7 @@
}
// special costs for the case we have reached our target
- if (target_seen) {
+ if (end_by_target_seen) {
n.flags_u.flags_s.m_targed_seen = true;
if (n.flags_u.flags_s.m_last_signal_was_red) {
if (n.m_last_red_signal_type == SIGTYPE_EXIT) {
@@ -356,7 +358,7 @@
// total node cost
n.m_cost = parent_cost + first_tile_cost + segment_cost + extra_cost;
- return !n.m_segment->flags_u.flags_s.m_end_of_line;
+ return !n.m_segment->flags_u.flags_s.m_end_of_line || end_by_target_seen;
}
FORCEINLINE bool CanUseGlobalCache(Node& n) const