summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r--src/pathfinder/yapf/yapf_common.hpp3
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp2
-rw-r--r--src/pathfinder/yapf/yapf_destrail.hpp9
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp3
4 files changed, 6 insertions, 11 deletions
diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp
index 660c23116..ac2e5b5a2 100644
--- a/src/pathfinder/yapf/yapf_common.hpp
+++ b/src/pathfinder/yapf/yapf_common.hpp
@@ -142,8 +142,7 @@ public:
/** Called by YAPF to detect if node ends in the desired destination */
inline bool PfDetectDestination(Node &n)
{
- bool bDest = (n.m_key.m_tile == m_destTile) && ((m_destTrackdirs & TrackdirToTrackdirBits(n.GetTrackdir())) != TRACKDIR_BIT_NONE);
- return bDest;
+ return (n.m_key.m_tile == m_destTile) && ((m_destTrackdirs & TrackdirToTrackdirBits(n.GetTrackdir())) != TRACKDIR_BIT_NONE);
}
/**
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index ca317f09a..5c5a7fbaf 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -104,7 +104,7 @@ public:
assert(IsValidTrackdir(td2));
int cost = 0;
if (TrackFollower::Allow90degTurns()
- && ((TrackdirToTrackdirBits(td2) & (TrackdirBits)TrackdirCrossesTrackdirs(td1)) != 0)) {
+ && ((TrackdirToTrackdirBits(td2) & TrackdirCrossesTrackdirs(td1)) != TRACKDIR_BIT_NONE)) {
/* 90-deg curve penalty */
cost += Yapf().PfGetSettings().rail_curve90_penalty;
} else if (td2 != NextTrackdir(td1)) {
diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp
index 03519b059..7b3f1c5a1 100644
--- a/src/pathfinder/yapf/yapf_destrail.hpp
+++ b/src/pathfinder/yapf/yapf_destrail.hpp
@@ -166,16 +166,13 @@ public:
/** Called by YAPF to detect if node ends in the desired destination */
inline bool PfDetectDestination(TileIndex tile, Trackdir td)
{
- bool bDest;
if (m_dest_station_id != INVALID_STATION) {
- bDest = HasStationTileRail(tile)
+ return HasStationTileRail(tile)
&& (GetStationIndex(tile) == m_dest_station_id)
&& (GetRailStationTrack(tile) == TrackdirToTrack(td));
- } else {
- bDest = (tile == m_destTile)
- && ((m_destTrackdirs & TrackdirToTrackdirBits(td)) != TRACKDIR_BIT_NONE);
}
- return bDest;
+
+ return (tile == m_destTile) && ((m_destTrackdirs & TrackdirToTrackdirBits(td)) != TRACKDIR_BIT_NONE);
}
/**
diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp
index 380b641da..b2ec6ae23 100644
--- a/src/pathfinder/yapf/yapf_road.cpp
+++ b/src/pathfinder/yapf/yapf_road.cpp
@@ -185,8 +185,7 @@ public:
/** Called by YAPF to detect if node ends in the desired destination */
inline bool PfDetectDestination(Node &n)
{
- bool bDest = IsRoadDepotTile(n.m_segment_last_tile);
- return bDest;
+ return IsRoadDepotTile(n.m_segment_last_tile);
}
inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)