(svn r17591) -Add [NoAI] [FS#3212]: AIAirport::IsAirportInformationAvailable. Also update several preconditions so it's now possible to get information on airports types that can no longer be build (small airport after 1960)
This commit is contained in:
@@ -19,7 +19,12 @@
|
||||
|
||||
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
|
||||
{
|
||||
return type >= 0 && type < (AirportType)NUM_AIRPORTS && ::GetAirport(type)->IsAvailable();
|
||||
return IsAirportInformationAvailable(type) && ::GetAirport(type)->IsAvailable();
|
||||
}
|
||||
|
||||
/* static */ bool AIAirport::IsAirportInformationAvailable(AirportType type)
|
||||
{
|
||||
return type >= 0 && type < (AirportType)NUM_AIRPORTS;
|
||||
}
|
||||
|
||||
/* static */ Money AIAirport::GetPrice(AirportType type)
|
||||
@@ -46,21 +51,21 @@
|
||||
|
||||
/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
|
||||
{
|
||||
if (!IsValidAirportType(type)) return -1;
|
||||
if (!IsAirportInformationAvailable(type)) return -1;
|
||||
|
||||
return ::GetAirport(type)->size_x;
|
||||
}
|
||||
|
||||
/* static */ int32 AIAirport::GetAirportHeight(AirportType type)
|
||||
{
|
||||
if (!IsValidAirportType(type)) return -1;
|
||||
if (!IsAirportInformationAvailable(type)) return -1;
|
||||
|
||||
return ::GetAirport(type)->size_y;
|
||||
}
|
||||
|
||||
/* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
|
||||
{
|
||||
if (!IsValidAirportType(type)) return -1;
|
||||
if (!IsAirportInformationAvailable(type)) return -1;
|
||||
|
||||
return _settings_game.station.modified_catchment ? ::GetAirport(type)->catchment : (uint)CA_UNMODIFIED;
|
||||
}
|
||||
@@ -143,7 +148,7 @@
|
||||
extern Town *AirportGetNearestTown(const AirportFTAClass *afc, TileIndex airport_tile);
|
||||
|
||||
if (!::IsValidTile(tile)) return INVALID_TOWN;
|
||||
if (!IsValidAirportType(type)) return INVALID_TOWN;
|
||||
if (!IsAirportInformationAvailable(type)) return INVALID_TOWN;
|
||||
|
||||
return AirportGetNearestTown(GetAirport(type), tile)->index;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user