From 9b800a96ed32720ff60b74e498a0e0a6351004f9 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Fri, 8 Jan 2021 10:16:18 +0000 Subject: Codechange: Remove min/max functions in favour of STL variants (#8502) --- src/pathfinder/follow_track.hpp | 2 +- src/pathfinder/npf/npf.cpp | 2 +- src/pathfinder/yapf/yapf_common.hpp | 2 +- src/pathfinder/yapf/yapf_destrail.hpp | 2 +- src/pathfinder/yapf/yapf_road.cpp | 2 +- src/pathfinder/yapf/yapf_ship.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/pathfinder') diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 2cfe4d9e4..5bc9ab03c 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -471,7 +471,7 @@ public: /* Check for speed limit imposed by railtype */ if (IsRailTT()) { uint16 rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed; - if (rail_speed > 0) max_speed = min(max_speed, rail_speed); + if (rail_speed > 0) max_speed = std::min(max_speed, rail_speed); } /* if min speed was requested, return it */ diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 34b85791b..5a5ff927e 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -117,7 +117,7 @@ static uint NPFDistanceTrack(TileIndex t0, TileIndex t1) const uint dx = Delta(TileX(t0), TileX(t1)); const uint dy = Delta(TileY(t0), TileY(t1)); - const uint straightTracks = 2 * min(dx, dy); // The number of straight (not full length) tracks + const uint straightTracks = 2 * std::min(dx, dy); // The number of straight (not full length) tracks /* OPTIMISATION: * Original: diagTracks = max(dx, dy) - min(dx,dy); * Proof: diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp index c6f7e6e5f..e0e43c468 100644 --- a/src/pathfinder/yapf/yapf_common.hpp +++ b/src/pathfinder/yapf/yapf_common.hpp @@ -164,7 +164,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp index 05a123577..7f89639bf 100644 --- a/src/pathfinder/yapf/yapf_destrail.hpp +++ b/src/pathfinder/yapf/yapf_destrail.hpp @@ -194,7 +194,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 1b85c8d4e..9d42f622d 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -303,7 +303,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 2f2ed7e44..ec4348e83 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -89,7 +89,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; -- cgit v1.2.3-70-g09d2