diff options
author | Yexo <Yexo@openttd.org> | 2009-02-05 01:15:54 +0000 |
---|---|---|
committer | Yexo <Yexo@openttd.org> | 2009-02-05 01:15:54 +0000 |
commit | 96f279608beda2113b10cf1cb9717954fd1ff329 (patch) | |
tree | 85c9d8cf146efb0bffe7348bcf6ccd390e05a9f3 /src/ai/api/ai_airport.cpp | |
parent | 8f51ee50c1d810a7472ed8a0194f2a6c36b36b99 (diff) | |
download | openttd-96f279608beda2113b10cf1cb9717954fd1ff329.tar.xz |
(svn r15346) -Add [NoAI]: Add AIAirport::GetNearestTown() so AIs can known in which town the noise level will increase.
Diffstat (limited to 'src/ai/api/ai_airport.cpp')
-rw-r--r-- | src/ai/api/ai_airport.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp index ec3d40029..cfe4df084 100644 --- a/src/ai/api/ai_airport.cpp +++ b/src/ai/api/ai_airport.cpp @@ -125,3 +125,13 @@ return 1; } + +/* static */ TownID AIAirport::GetNearestTown(TileIndex tile, AirportType type) +{ + extern Town *AirportGetNearestTown(const AirportFTAClass *afc, TileIndex airport_tile); + + if (!::IsValidTile(tile)) return INVALID_TOWN; + if (!IsValidAirportType(type)) return INVALID_TOWN; + + return AirportGetNearestTown(GetAirport(type), tile)->index; +} |