summaryrefslogtreecommitdiff
path: root/src/newgrf_station.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/newgrf_station.cpp
parentc1fddb9a6ae5c3af6865461a7295788a341011a2 (diff)
downloadopenttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/newgrf_station.cpp')
-rw-r--r--src/newgrf_station.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index d607f8bd0..a127d54c9 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -119,13 +119,13 @@ uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, i
SB(retval, 0, 4, y & 0xF);
SB(retval, 4, 4, x & 0xF);
} else {
- SB(retval, 0, 4, min(15, y));
- SB(retval, 4, 4, min(15, length - y - 1));
- SB(retval, 8, 4, min(15, x));
- SB(retval, 12, 4, min(15, platforms - x - 1));
+ SB(retval, 0, 4, std::min(15, y));
+ SB(retval, 4, 4, std::min(15, length - y - 1));
+ SB(retval, 8, 4, std::min(15, x));
+ SB(retval, 12, 4, std::min(15, platforms - x - 1));
}
- SB(retval, 16, 4, min(15, length));
- SB(retval, 20, 4, min(15, platforms));
+ SB(retval, 16, 4, std::min(15, length));
+ SB(retval, 20, 4, std::min(15, platforms));
SB(retval, 24, 4, tile);
return retval;
@@ -424,7 +424,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, b
const GoodsEntry *ge = &this->goods[c];
switch (variable) {
- case 0x60: return min(ge->cargo.TotalCount(), 4095);
+ case 0x60: return std::min(ge->cargo.TotalCount(), 4095u);
case 0x61: return ge->HasVehicleEverTriedLoading() ? ge->time_since_pickup : 0;
case 0x62: return ge->HasRating() ? ge->rating : 0xFFFFFFFF;
case 0x63: return ge->cargo.DaysInTransit();
@@ -444,7 +444,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, b
const GoodsEntry *g = &this->goods[GB(variable - 0x8C, 3, 4)];
switch (GB(variable - 0x8C, 0, 3)) {
case 0: return g->cargo.TotalCount();
- case 1: return GB(min(g->cargo.TotalCount(), 4095), 0, 4) | (GB(g->status, GoodsEntry::GES_ACCEPTANCE, 1) << 7);
+ case 1: return GB(std::min(g->cargo.TotalCount(), 4095u), 0, 4) | (GB(g->status, GoodsEntry::GES_ACCEPTANCE, 1) << 7);
case 2: return g->time_since_pickup;
case 3: return g->rating;
case 4: return g->cargo.Source();
@@ -520,7 +520,7 @@ uint32 Waypoint::GetNewGRFVariable(const ResolverObject &object, byte variable,
}
if (HasBit(this->station_scope.statspec->flags, SSF_DIV_BY_STATION_SIZE)) cargo /= (st->train_station.w + st->train_station.h);
- cargo = min(0xfff, cargo);
+ cargo = std::min(0xfffu, cargo);
if (cargo > this->station_scope.statspec->cargo_threshold) {
if (group->num_loading > 0) {