Fix: [NewGRF] industry variable 66 and object variable 46 clamped the squared-euclidian distance to 16 bit, when they should not.

(cherry picked from commit 2cf5df2a50)
This commit is contained in:
frosch
2021-05-02 00:01:06 +02:00
committed by Jonathan G Rennison
parent dbcd115a4c
commit e856d3f8fe
2 changed files with 4 additions and 4 deletions

View File

@@ -286,11 +286,11 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
TileIndex tile = GetNearbyTile(parameter, this->tile, true);
return GetTownRadiusGroup(this->industry->town, tile) << 16 | std::min(DistanceManhattan(tile, this->industry->town->xy), 0xFFFFu);
}
/* Get square of Euclidian distance of closes town */
/* Get square of Euclidian distance of closest town */
case 0x66: {
if (this->tile == INVALID_TILE) break;
TileIndex tile = GetNearbyTile(parameter, this->tile, true);
return GetTownRadiusGroup(this->industry->town, tile) << 16 | std::min(DistanceSquare(tile, this->industry->town->xy), 0xFFFFu);
return DistanceSquare(tile, this->industry->town->xy);
}
/* Count of industry, distance of closest instance