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/tilearea.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/tilearea.cpp') diff --git a/src/tilearea.cpp b/src/tilearea.cpp index 3f240feb4..84ac7a90f 100644 --- a/src/tilearea.cpp +++ b/src/tilearea.cpp @@ -57,10 +57,10 @@ void OrthogonalTileArea::Add(TileIndex to_add) uint ax = TileX(to_add); uint ay = TileY(to_add); - sx = min(ax, sx); - sy = min(ay, sy); - ex = max(ax, ex); - ey = max(ay, ey); + sx = std::min(ax, sx); + sy = std::min(ay, sy); + ex = std::max(ax, ex); + ey = std::max(ay, ey); this->tile = TileXY(sx, sy); this->w = ex - sx + 1; @@ -125,10 +125,10 @@ OrthogonalTileArea &OrthogonalTileArea::Expand(int rad) int x = TileX(this->tile); int y = TileY(this->tile); - int sx = max(x - rad, 0); - int sy = max(y - rad, 0); - int ex = min(x + this->w + rad, MapSizeX()); - int ey = min(y + this->h + rad, MapSizeY()); + int sx = std::max(x - rad, 0); + int sy = std::max(y - rad, 0); + int ex = std::min(x + this->w + rad, MapSizeX()); + int ey = std::min(y + this->h + rad, MapSizeY()); this->tile = TileXY(sx, sy); this->w = ex - sx; @@ -142,8 +142,8 @@ OrthogonalTileArea &OrthogonalTileArea::Expand(int rad) void OrthogonalTileArea::ClampToMap() { assert(this->tile < MapSize()); - this->w = min(this->w, MapSizeX() - TileX(this->tile)); - this->h = min(this->h, MapSizeY() - TileY(this->tile)); + this->w = std::min(this->w, MapSizeX() - TileX(this->tile)); + this->h = std::min(this->h, MapSizeY() - TileY(this->tile)); } /** @@ -225,9 +225,9 @@ TileIterator &DiagonalTileIterator::operator++() /* Special case: Every second column has zero length, skip them completely */ this->a_cur = 0; if (this->b_max > 0) { - this->b_cur = min(this->b_cur + 2, this->b_max); + this->b_cur = std::min(this->b_cur + 2, this->b_max); } else { - this->b_cur = max(this->b_cur - 2, this->b_max); + this->b_cur = std::max(this->b_cur - 2, this->b_max); } } else { /* Every column has at least one tile to process */ -- cgit v1.2.3-54-g00ecf