(svn r5065) -CodeChange: [YAPF] Added PfDetectDestination(tile, trackdir) for trains (to be used by platform selection feature)

This commit is contained in:
KUDr
2006-06-01 21:00:59 +00:00
parent bf2fb59bf9
commit 76a8f036df
2 changed files with 21 additions and 8 deletions

View File

@@ -35,7 +35,13 @@ public:
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(Node& n)
{
bool bDest = IsTileDepotType(n.GetLastTile(), TRANSPORT_RAIL);
return PfDetectDestination(n.GetLastTile(), n.GetLastTrackdir());
}
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
{
bool bDest = IsTileDepotType(tile, TRANSPORT_RAIL);
return bDest;
}
@@ -92,15 +98,21 @@ public:
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(Node& n)
{
return PfDetectDestination(n.GetLastTile(), n.GetLastTrackdir());
}
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
{
bool bDest;
if (m_dest_station_id != INVALID_STATION) {
bDest = IsRailwayStationTile(n.GetLastTile())
&& (GetStationIndex(n.GetLastTile()) == m_dest_station_id)
&& (GetRailStationTrack(n.GetLastTile()) == TrackdirToTrack(n.GetLastTrackdir()));
bDest = IsRailwayStationTile(tile)
&& (GetStationIndex(tile) == m_dest_station_id)
&& (GetRailStationTrack(tile) == TrackdirToTrack(td));
} else {
bDest = (n.GetLastTile() == m_destTile)
&& ((m_destTrackdirs & TrackdirToTrackdirBits(n.GetLastTrackdir())) != TRACKDIR_BIT_NONE);
bDest = (tile == m_destTile)
&& ((m_destTrackdirs & TrackdirToTrackdirBits(td)) != TRACKDIR_BIT_NONE);
}
return bDest;
}