summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_costrail.hpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-06-18 14:40:07 +0000
committerKUDr <kudr@openttd.org>2007-06-18 14:40:07 +0000
commitfad2a36b8f9ce57610532226b2f14cbadc40fae9 (patch)
treecc8f707ad77f07d941100d315c6884eaa2ed293a /src/yapf/yapf_costrail.hpp
parent0c369c21e0ed1056c88e9f8ad157222f501d5fa5 (diff)
downloadopenttd-fad2a36b8f9ce57610532226b2f14cbadc40fae9.tar.xz
(svn r10199) -Fix [FS#884, YAPF]: 'target_seen' flag that is set prematurely in some cases (1 tile long cached segment followed by target station) stops on assert (immeR)
Diffstat (limited to 'src/yapf/yapf_costrail.hpp')
-rw-r--r--src/yapf/yapf_costrail.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index ffde3703b..9dc2cc701 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -195,6 +195,7 @@ public:
RailType rail_type = GetTileRailType(tile);
bool target_seen = Yapf().PfDetectDestination(tile, trackdir);
+ bool end_by_target_seen = false;
if (tf.m_is_station) {
// station tiles have an extra penalty
@@ -212,6 +213,7 @@ public:
// finish if we have reached the destination
if (target_seen) {
+ end_by_target_seen = true;
break;
}
@@ -342,7 +344,7 @@ public:
}
// 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) {
@@ -358,7 +360,7 @@ public:
// 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