| Old revision #ppqwyyw9s | New revision #phoeeb6pa | ||
|---|---|---|---|
| 1 | Index: src/pathfinder/follow_track.hpp | ||
| 2 | =================================================================== | ||
| 3 | --- src/pathfinder/follow_track.hpp (revision 27829) | ||
| 4 | +++ src/pathfinder/follow_track.hpp (working copy) | ||
| 5 | @@ -438,6 +438,21 @@ | ||
| 6 | return true; | ||
| 7 | } | ||
| 8 | } | ||
| 9 | + | ||
| 10 | + if (IsWaterTT()) { | ||
| 11 | + /* if we reached a dead end, we can reverse the ship and continue moving */ | ||
| 12 | + m_exitdir = ReverseDiagDir(m_exitdir); | ||
| 13 | + /* new tile will be the same as old one */ | ||
| 14 | + m_new_tile = m_old_tile; | ||
| 15 | + /* set new trackdir bits to all reachable trackdirs */ | ||
| 16 | + QueryNewTileTrackStatus(); | ||
| 17 | + m_new_td_bits &= DiagdirReachesTrackdirs(m_exitdir); | ||
| 18 | + if (m_new_td_bits != TRACKDIR_BIT_NONE) { | ||
| 19 | + /* we have some trackdirs reachable after reversal */ | ||
| 20 | + return true; | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | m_err = EC_NO_WAY; | ||
| 25 | return false; | ||
| 26 | } | ||
| 1 | Index: src/pathfinder/yapf/yapf.h | 27 | Index: src/pathfinder/yapf/yapf.h |
| 2 | =================================================================== | 28 | =================================================================== |
| 3 | --- src/pathfinder/yapf/yapf.h (revision 27829) | 29 | --- src/pathfinder/yapf/yapf.h (revision 27829) | … | … |
| 101 | + /** Called by YAPF to detect if node ends in the desired destination */ | 127 | + /** Called by YAPF to detect if node ends in the desired destination */ |
| 102 | + inline bool PfDetectDestination(Node &n) | 128 | + inline bool PfDetectDestination(Node &n) |
| 103 | + { | 129 | + { |
| 104 | + bool bDest = IsShipDepotTile(n.m_segment_last_tile) | 104 | + bool bDest = IsShipDepotTile(n.m_segment_last_tile) && GetShipDepotPart(n.m_segment_last_tile) == DEPOT_PART_NORTH; |
| 105 | + return bDest; | 131 | + return bDest; |
| 106 | + } | 132 | + } |
| 107 | + | 133 | + |
| 108 | + inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir) | 134 | + inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir) |
| 109 | + { | 135 | + { |
| 110 | + return IsShipDepotTile( | 110 | + return IsShipDepotTile(n.m_segment_last_tile) && GetShipDepotPart(n.m_segment_last_tile) == DEPOT_PART_NORTH; |
| 111 | + } | 137 | + } |
| 112 | + | 138 | + |
| 113 | + /** | 139 | + /** | … | … |
| 203 | - * other hand if we have set a maximum distance, any depot | 229 | - * other hand if we have set a maximum distance, any depot |
| 204 | - * further away than max_distance can safely be ignored. */ | 230 | - * further away than max_distance can safely be ignored. */ |
| 205 | - uint best_dist = max_distance == 0 ? UINT_MAX : max_distance + 1; | 231 | - uint best_dist = max_distance == 0 ? UINT_MAX : max_distance + 1; |
| 206 | + if (IsShipDepotTile(v->tile) | 206 | + if (IsShipDepotTile(v->tile) && GetShipDepotPart(v->tile) == DEPOT_PART_NORTH) return FindDepotData(v->tile, 0); |
| 207 | 233 | ||
| 208 | - FOR_ALL_DEPOTS(depot) { | 234 | - FOR_ALL_DEPOTS(depot) { |
| 209 | - TileIndex tile = depot->xy; | 235 | - TileIndex tile = depot->xy; |