summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-17 23:07:53 +0000
committerrubidium <rubidium@openttd.org>2010-11-17 23:07:53 +0000
commit6878a0ffd7e4613ae9cf45888529a6033375ed04 (patch)
treeb8db45b52a6a39a44d37e754ea36246e57d9bb25 /src
parent19cbf9b47950b3254b4445e6a04b845c5b294cd0 (diff)
downloadopenttd-6878a0ffd7e4613ae9cf45888529a6033375ed04.tar.xz
(svn r21229) -Fix [FS#4130]: [YAPF] Road vehicles not finding the nearest depot in some (corner) cases
Diffstat (limited to 'src')
-rw-r--r--src/pathfinder/follow_track.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp
index d7d8569e9..8656a4f05 100644
--- a/src/pathfinder/follow_track.hpp
+++ b/src/pathfinder/follow_track.hpp
@@ -131,6 +131,18 @@ struct CFollowTrackT
if (!CanEnterNewTile()) return false;
m_new_td_bits &= DiagdirReachesTrackdirs(m_exitdir);
if (m_new_td_bits == TRACKDIR_BIT_NONE) {
+ /* In case we can't enter the next tile, but are
+ * a normal road vehicle, then we can actually
+ * try to reverse as this is the end of the road.
+ * Trams can only turn on the appropriate bits in
+ * which case reaching this would mean a dead end
+ * near a building and in that case there would
+ * a "false" QueryNewTileTrackStatus result and
+ * as such reversing is already tried. The fact
+ * that function failed can have to do with a
+ * missing road bit, or inability to connect the
+ * different bits due to slopes. */
+ if (IsRoadTT() && !IsTram() && TryReverse()) return true;
m_err = EC_NO_WAY;
return false;
}