summaryrefslogtreecommitdiff
path: root/src/tilearea.cpp
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2021-01-08 10:16:18 +0000
committerGitHub <noreply@github.com>2021-01-08 11:16:18 +0100
commit9b800a96ed32720ff60b74e498a0e0a6351004f9 (patch)
tree3f287d339e15c4902ee415556475fd9b2918d33c /src/tilearea.cpp
parentc1fddb9a6ae5c3af6865461a7295788a341011a2 (diff)
downloadopenttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/tilearea.cpp')
-rw-r--r--src/tilearea.cpp24
1 files changed, 12 insertions, 12 deletions
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<int>(x - rad, 0);
+ int sy = std::max<int>(y - rad, 0);
+ int ex = std::min<int>(x + this->w + rad, MapSizeX());
+ int ey = std::min<int>(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<int>(this->w, MapSizeX() - TileX(this->tile));
+ this->h = std::min<int>(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 */