summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2021-05-02 00:01:06 +0200
committerCharles Pigott <charlespigott@googlemail.com>2021-05-02 13:45:43 +0100
commit2cf5df2a50e9f28ef4ba93a765bfcf79afcbb20c (patch)
tree21e44599ae204ba3582273f17aba83d92bbd6397 /src/newgrf_object.cpp
parent84aa17cea6f677f2bd6cb0e1c33457dbdcda77dc (diff)
downloadopenttd-2cf5df2a50e9f28ef4ba93a765bfcf79afcbb20c.tar.xz
Fix: [NewGRF] industry variable 66 and object variable 46 clamped the squared-euclidian distance to 16 bit, when they should not.
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 649a4b58a..3c069f4c9 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -303,8 +303,8 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
/* 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);
- /* Get square of Euclidian distance of closes town */
- case 0x46: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceSquare(this->tile, t->xy), 0xFFFFu);
+ /* Get square of Euclidian distance of closest town */
+ case 0x46: return DistanceSquare(this->tile, t->xy);
/* Object colour */
case 0x47: return this->obj->colour;