diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -249,7 +249,7 @@ static uint32 GetCountAndDistanceOfClose /* 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 | std::min(GetClosestObject(tile, idx, current), 0xFFFFu); + return Object::GetTypeCount(idx) << 16 | ClampTo(GetClosestObject(tile, idx, current)); } /** Used by the resolver to get values for feature 0F deterministic spritegroups. */ @@ -324,7 +324,7 @@ static uint32 GetCountAndDistanceOfClose case 0x44: return GetTileOwner(this->tile); /* Get town zone and Manhattan distance of closest town */ - case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceManhattan(this->tile, t->xy), 0xFFFFu); + case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | ClampTo(DistanceManhattan(this->tile, t->xy)); /* Get square of Euclidian distance of closest town */ case 0x46: return DistanceSquare(this->tile, t->xy);