Codechange: Remove min/max functions in favour of STL variants (#8502)
This commit is contained in:
@@ -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<int>(max_speed, rail_speed);
|
||||
}
|
||||
|
||||
/* if min speed was requested, return it */
|
||||
|
@@ -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:
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user