summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-12-20 15:30:18 +0000
committerfrosch <frosch@openttd.org>2008-12-20 15:30:18 +0000
commitb916d20e1c7912ae3105499a1f652e4790e68596 (patch)
treeafbcda65a54ef89b67ef083627b22c30ab304f19 /src/yapf
parentf1e02ab1edb68748a3bb652976f5fae5a30b4fa5 (diff)
downloadopenttd-b916d20e1c7912ae3105499a1f652e4790e68596.tar.xz
(svn r14703) -Fix (r8735): [YAPF] YapfRoadVehDistanceToTile() shall not abort searching at v->dest_tile, when it in fact tries to reach another tile.
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/yapf_road.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp
index 55ace4a12..6186f1ac1 100644
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -85,7 +85,7 @@ public:
const Vehicle *v = Yapf().GetVehicle();
// we have reached the vehicle's destination - segment should end here to avoid target skipping
- if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
+ if (Yapf().PfDetectDestinationTile(tile, trackdir)) break;
// stop if we have just entered the depot
if (IsRoadDepotTile(tile) && trackdir == DiagDirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
@@ -153,6 +153,11 @@ public:
return bDest;
}
+ FORCEINLINE bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)
+ {
+ return IsRoadDepotTile(tile);
+ }
+
/** Called by YAPF to calculate cost estimate. Calculates distance to the destination
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
FORCEINLINE bool PfCalcEstimate(Node& n)
@@ -195,6 +200,11 @@ public:
return bDest;
}
+ FORCEINLINE bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)
+ {
+ return tile == m_destTile && ((m_destTrackdirs & TrackdirToTrackdirBits(trackdir)) != TRACKDIR_BIT_NONE);
+ }
+
/** Called by YAPF to calculate cost estimate. Calculates distance to the destination
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
inline bool PfCalcEstimate(Node& n)