diff options
author | frosch <frosch@openttd.org> | 2021-05-01 23:59:53 +0200 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2021-05-02 13:45:43 +0100 |
commit | 84aa17cea6f677f2bd6cb0e1c33457dbdcda77dc (patch) | |
tree | 9d5bb8037552dc731a73090732b01d9019777d39 /src/newgrf_industries.cpp | |
parent | 56aa6d0eddb60fac20cde82cd496005369ca1b8d (diff) | |
download | openttd-84aa17cea6f677f2bd6cb0e1c33457dbdcda77dc.tar.xz |
Fix: [NewGRF] industry variables 65 and 66 ignored the parameter, and always used the north tile.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r-- | src/newgrf_industries.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 5e59634e8..68f28148c 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -281,13 +281,17 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout if (this->tile == INVALID_TILE) break; return GetClosestIndustry(this->tile, MapNewGRFIndustryType(parameter, indspec->grf_prop.grffile->grfid), this->industry); /* Get town zone and Manhattan distance of closest town */ - case 0x65: + case 0x65: { if (this->tile == INVALID_TILE) break; - return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | std::min(DistanceManhattan(this->tile, this->industry->town->xy), 0xFFFFu); + 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 */ - case 0x66: + case 0x66: { if (this->tile == INVALID_TILE) break; - return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | std::min(DistanceSquare(this->tile, this->industry->town->xy), 0xFFFFu); + TileIndex tile = GetNearbyTile(parameter, this->tile, true); + return GetTownRadiusGroup(this->industry->town, tile) << 16 | std::min(DistanceSquare(tile, this->industry->town->xy), 0xFFFFu); + } /* Count of industry, distance of closest instance * 68 is the same as 67, but with a filtering on selected layout */ |