changeset 10448:3aeb16c0dd59 draft

(svn r14703) -Fix (r8735): [YAPF] YapfRoadVehDistanceToTile() shall not abort searching at v->dest_tile, when it in fact tries to reach another tile.
author frosch <frosch@openttd.org>
date Sat, 20 Dec 2008 15:30:18 +0000
parents 561a608ed4bc
children 66c472c8e137
files src/yapf/yapf_road.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -85,7 +85,7 @@
 
 			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 @@
 		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 @@
 		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)