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/newgrf_object.cpp | |
parent | c1fddb9a6ae5c3af6865461a7295788a341011a2 (diff) | |
download | openttd-9b800a96ed32720ff60b74e498a0e0a6351004f9.tar.xz |
Codechange: Remove min/max functions in favour of STL variants (#8502)
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r-- | src/newgrf_object.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 8827245d3..649a4b58a 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -189,7 +189,7 @@ static uint32 GetClosestObject(TileIndex tile, ObjectType type, const Object *cu for (const Object *o : Object::Iterate()) { if (o->type != type || o == current) continue; - best_dist = min(best_dist, DistanceManhattan(tile, o->location.tile)); + best_dist = std::min(best_dist, DistanceManhattan(tile, o->location.tile)); } return best_dist; @@ -226,7 +226,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid, /* If the object type is invalid, there is none and the closest is far away. */ if (idx >= NUM_OBJECTS) return 0 | 0xFFFF; - return Object::GetTypeCount(idx) << 16 | min(GetClosestObject(tile, idx, current), 0xFFFF); + return Object::GetTypeCount(idx) << 16 | std::min(GetClosestObject(tile, idx, current), 0xFFFFu); } /** Used by the resolver to get values for feature 0F deterministic spritegroups. */ @@ -301,10 +301,10 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid, case 0x44: return GetTileOwner(this->tile); /* Get town zone and Manhattan distance of closest town */ - case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | min(DistanceManhattan(this->tile, t->xy), 0xFFFF); + case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceManhattan(this->tile, t->xy), 0xFFFFu); /* Get square of Euclidian distance of closes town */ - case 0x46: return GetTownRadiusGroup(t, this->tile) << 16 | min(DistanceSquare(this->tile, t->xy), 0xFFFF); + case 0x46: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceSquare(this->tile, t->xy), 0xFFFFu); /* Object colour */ case 0x47: return this->obj->colour; |