summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-01-26 21:09:17 +0000
committersmatz <smatz@openttd.org>2009-01-26 21:09:17 +0000
commit659989af457fef67348fb1f2145ba7ff66c92d4d (patch)
tree94e85db8f651f007bb6cbb5a4e0b44c9acc48462 /src/ai
parent7f9c91901ee4e55f98fe2cc83ea81000eba7c06e (diff)
downloadopenttd-659989af457fef67348fb1f2145ba7ff66c92d4d.tar.xz
(svn r15278) -Fix [FS#2332]: test noise limit of nearest town instead of st->town
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_airport.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp
index cb8693255..2b0c3155b 100644
--- a/src/ai/api/ai_airport.cpp
+++ b/src/ai/api/ai_airport.cpp
@@ -115,6 +115,7 @@
/* static */ int AIAirport::GetNoiseLevelIncrease(TileIndex tile, AirportType type)
{
+ extern Town *AirportGetNearestTown(const AirportFTAClass *afc, TileIndex airport_tile);
extern uint8 GetAirportNoiseLevelForTown(const AirportFTAClass *afc, TileIndex town_tile, TileIndex tile);
if (!::IsValidTile(tile)) return -1;
@@ -122,7 +123,7 @@
if (_settings_game.economy.station_noise_level) {
const AirportFTAClass *afc = ::GetAirport(type);
- const Town *t = ::ClosestTownFromTile(tile, UINT_MAX);
+ const Town *t = AirportGetNearestTown(afc, tile);
return GetAirportNoiseLevelForTown(afc, t->xy, tile);
}