diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-25 22:46:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 22:46:46 +0100 |
commit | d4583fa64c067c00d3a7592642b3c269d02a8bef (patch) | |
tree | 942865605eb6ae2385ce5e4b5d7a010064586dbb /src/pathfinder/follow_track.hpp | |
parent | 9209807d662a619ee8c3edcae0d5b5fcf6db6d1d (diff) | |
download | openttd-d4583fa64c067c00d3a7592642b3c269d02a8bef.tar.xz |
Fix #8123: trams on half-tiles couldn't find depots (#8738)
Basically, follow_track.hpp contains a fix for half-tiles, but
this wasn't duplicated for when trying to find a depot and in
a few other places. This makes sure all places act the same.
Diffstat (limited to 'src/pathfinder/follow_track.hpp')
-rw-r--r-- | src/pathfinder/follow_track.hpp | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index cac8ec5c5..9b95578fd 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -17,6 +17,7 @@ #include "../tunnelbridge.h" #include "../tunnelbridge_map.h" #include "../depot_map.h" +#include "pathfinder_func.h" #include "pf_performance_timer.hpp" /** @@ -239,26 +240,10 @@ protected: CPerfStart perf(*m_pPerf); if (IsRailTT() && IsPlainRailTile(m_new_tile)) { m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101); + } else if (IsRoadTT()) { + m_new_td_bits = GetTrackdirBitsForRoad(m_new_tile, this->IsTram() ? RTT_TRAM : RTT_ROAD); } else { - m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), IsRoadTT() ? (this->IsTram() ? RTT_TRAM : RTT_ROAD) : 0)); - - if (IsTram() && m_new_td_bits == TRACKDIR_BIT_NONE) { - /* GetTileTrackStatus() returns 0 for single tram bits. - * As we cannot change it there (easily) without breaking something, change it here */ - switch (GetSingleTramBit(m_new_tile)) { - case DIAGDIR_NE: - case DIAGDIR_SW: - m_new_td_bits = TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW; - break; - - case DIAGDIR_NW: - case DIAGDIR_SE: - m_new_td_bits = TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_Y_SE; - break; - - default: break; - } - } + m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), 0)); } return (m_new_td_bits != TRACKDIR_BIT_NONE); } |