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