Loading

Revision differences

Old revision #phoeeb6paNew revision #pxmwekzc2
1Index: 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     }    
27Index: src/pathfinder/yapf/yapf.h  1Index: src/pathfinder/yapf/yapf.h  
28===================================================================  2===================================================================  
29--- src/pathfinder/yapf/yapf.h    (revision 27829)  3--- src/pathfinder/yapf/yapf.h    (revision 27829)  
  
127+    /** Called by YAPF to detect if node ends in the desired destination */  101+    /** Called by YAPF to detect if node ends in the desired destination */  
128+    inline bool PfDetectDestination(Node &n)  102+    inline bool PfDetectDestination(Node &n)  
129+    {  103+    {  
130+        bool bDest = IsShipDepotTile(n.m_segment_last_tile) && GetShipDepotPart(n.m_segment_last_tile) == DEPOT_PART_NORTH;  130+        bool bDest = IsShipDepotTile(n.m_segment_last_tile);
131+        return bDest;  105+        return bDest;  
132+    }  106+    }  
133+  107+  
134+    inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)  108+    inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)  
135+    {  109+    {  
136+        return IsShipDepotTile(n.m_segment_last_tile) && GetShipDepotPart(n.m_segment_last_tile) == DEPOT_PART_NORTH;  136+        return IsShipDepotTile(tile);
137+    }  111+    }  
138+  112+  
139+    /**  113+    /**  
  
229-     * other hand if we have set a maximum distance, any depot  203-     * other hand if we have set a maximum distance, any depot  
230-     * further away than max_distance can safely be ignored. */  204-     * further away than max_distance can safely be ignored. */  
231-    uint best_dist = max_distance == 0 ? UINT_MAX : max_distance + 1;  205-    uint best_dist = max_distance == 0 ? UINT_MAX : max_distance + 1;  
232+    if (IsShipDepotTile(v->tile) && GetShipDepotPart(v->tile) == DEPOT_PART_NORTH) return FindDepotData(v->tile, 0);  232+    if (IsShipDepotTile(v->tile)) return FindDepotData(v->tile, 0);
233   207   
234-    FOR_ALL_DEPOTS(depot) {  208-    FOR_ALL_DEPOTS(depot) {  
235-        TileIndex tile = depot->xy;  209-        TileIndex tile = depot->xy;