mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r14703) -Fix (r8735): [YAPF] YapfRoadVehDistanceToTile() shall not abort searching at v->dest_tile, when it in fact tries to reach another tile.
This commit is contained in:
parent
f1e02ab1ed
commit
b916d20e1c
@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
const Vehicle *v = Yapf().GetVehicle();
|
const Vehicle *v = Yapf().GetVehicle();
|
||||||
// we have reached the vehicle's destination - segment should end here to avoid target skipping
|
// 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
|
// stop if we have just entered the depot
|
||||||
if (IsRoadDepotTile(tile) && trackdir == DiagDirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
|
if (IsRoadDepotTile(tile) && trackdir == DiagDirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
|
||||||
@ -153,6 +153,11 @@ public:
|
|||||||
return bDest;
|
return bDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCEINLINE bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)
|
||||||
|
{
|
||||||
|
return IsRoadDepotTile(tile);
|
||||||
|
}
|
||||||
|
|
||||||
/** Called by YAPF to calculate cost estimate. Calculates distance to the destination
|
/** 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 */
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
||||||
FORCEINLINE bool PfCalcEstimate(Node& n)
|
FORCEINLINE bool PfCalcEstimate(Node& n)
|
||||||
@ -195,6 +200,11 @@ public:
|
|||||||
return bDest;
|
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
|
/** 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 */
|
* adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
|
||||||
inline bool PfCalcEstimate(Node& n)
|
inline bool PfCalcEstimate(Node& n)
|
||||||
|
Loading…
Reference in New Issue
Block a user