diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2021-01-08 10:16:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 11:16:18 +0100 |
commit | 9b800a96ed32720ff60b74e498a0e0a6351004f9 (patch) | |
tree | 3f287d339e15c4902ee415556475fd9b2918d33c /src/station.cpp | |
parent | c1fddb9a6ae5c3af6865461a7295788a341011a2 (diff) | |
download | openttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz |
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/station.cpp')
-rw-r--r-- | src/station.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/station.cpp b/src/station.cpp index 6f55574ac..f859495d1 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -320,11 +320,11 @@ uint Station::GetCatchmentRadius() const uint ret = CA_NONE; if (_settings_game.station.modified_catchment) { - if (this->bus_stops != nullptr) ret = max<uint>(ret, CA_BUS); - if (this->truck_stops != nullptr) ret = max<uint>(ret, CA_TRUCK); - if (this->train_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_TRAIN); - if (this->ship_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_DOCK); - if (this->airport.tile != INVALID_TILE) ret = max<uint>(ret, this->airport.GetSpec()->catchment); + if (this->bus_stops != nullptr) ret = std::max<uint>(ret, CA_BUS); + if (this->truck_stops != nullptr) ret = std::max<uint>(ret, CA_TRUCK); + if (this->train_station.tile != INVALID_TILE) ret = std::max<uint>(ret, CA_TRAIN); + if (this->ship_station.tile != INVALID_TILE) ret = std::max<uint>(ret, CA_DOCK); + if (this->airport.tile != INVALID_TILE) ret = std::max<uint>(ret, this->airport.GetSpec()->catchment); } else { if (this->bus_stops != nullptr || this->truck_stops != nullptr || this->train_station.tile != INVALID_TILE || this->ship_station.tile != INVALID_TILE || this->airport.tile != INVALID_TILE) { ret = CA_UNMODIFIED; @@ -346,10 +346,10 @@ Rect Station::GetCatchmentRect() const int catchment_radius = this->GetCatchmentRadius(); Rect ret = { - max<int>(this->rect.left - catchment_radius, 0), - max<int>(this->rect.top - catchment_radius, 0), - min<int>(this->rect.right + catchment_radius, MapMaxX()), - min<int>(this->rect.bottom + catchment_radius, MapMaxY()) + std::max<int>(this->rect.left - catchment_radius, 0), + std::max<int>(this->rect.top - catchment_radius, 0), + std::min<int>(this->rect.right + catchment_radius, MapMaxX()), + std::min<int>(this->rect.bottom + catchment_radius, MapMaxY()) }; return ret; @@ -523,7 +523,7 @@ CommandCost StationRect::BeforeAddTile(TileIndex tile, StationRectMode mode) } else if (!this->PtInExtendedRect(x, y)) { /* current rect is not empty and new point is outside this rect * make new spread-out rectangle */ - Rect new_rect = {min(x, this->left), min(y, this->top), max(x, this->right), max(y, this->bottom)}; + Rect new_rect = {std::min(x, this->left), std::min(y, this->top), std::max(x, this->right), std::max(y, this->bottom)}; /* check new rect dimensions against preset max */ int w = new_rect.right - new_rect.left + 1; |