forked from mirror/OpenTTD
Codechange: Remove min/max functions in favour of STL variants (#8502)
This commit is contained in:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user