summaryrefslogtreecommitdiff
path: root/yapf/yapf_destrail.hpp
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2006-06-01 21:00:59 +0000
committerKUDr <KUDr@openttd.org>2006-06-01 21:00:59 +0000
commit60957de40964e422978a6d754cb2f27c06466dab (patch)
tree168b052560c9309b0e9546138e7f686272557e3e /yapf/yapf_destrail.hpp
parent53cc2673ab09e8d0595ec8ecd1b0ffbbf47aad4a (diff)
downloadopenttd-60957de40964e422978a6d754cb2f27c06466dab.tar.xz
(svn r5065) -CodeChange: [YAPF] Added PfDetectDestination(tile, trackdir) for trains (to be used by platform selection feature)
Diffstat (limited to 'yapf/yapf_destrail.hpp')
-rw-r--r--yapf/yapf_destrail.hpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/yapf/yapf_destrail.hpp b/yapf/yapf_destrail.hpp
index c7b3a63a0..2720772f8 100644
--- a/yapf/yapf_destrail.hpp
+++ b/yapf/yapf_destrail.hpp
@@ -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;
}
@@ -93,14 +99,20 @@ 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;
}