(svn r15278) -Fix [FS#2332]: test noise limit of nearest town instead of st->town

This commit is contained in:
smatz
2009-01-26 21:09:17 +00:00
parent 7f9c91901e
commit 659989af45
2 changed files with 63 additions and 40 deletions

View File

@@ -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);
}