Fix: AirportGetNearestTown incorrectly assumed first TileIterator result was origin. (#11565)

Not all TileIterators are equal, and some do not start at the top-corner, so the perimeter check was wrong. As the caller already has thie origin tile, use that instead.
This commit is contained in:
Peter Nelson
2023-12-09 09:47:41 +00:00
committed by GitHub
parent 10f94fb0dd
commit c0ea0589b4
3 changed files with 12 additions and 9 deletions

View File

@@ -16,7 +16,7 @@
enum StationClassID : byte;
enum RoadStopClassID : byte;
extern Town *AirportGetNearestTown(const struct AirportSpec *as, const TileIterator &it, uint &mindist);
extern Town *AirportGetNearestTown(const struct AirportSpec *as, TileIndex tile, const TileIterator &it, uint &mindist);
extern uint8_t GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint distance);
CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent);