src/ai/api/ai_airport.cpp
branchnoai
changeset 10194 c9fdeb7450da
parent 9868 3998f2e73dda
child 10513 33cb70ff2f5d
equal deleted inserted replaced
10193:9f73edc0c57a 10194:c9fdeb7450da
    24 	return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
    24 	return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
    25 }
    25 }
    26 
    26 
    27 /* static */ bool AIAirport::AirportAvailable(AirportType type)
    27 /* static */ bool AIAirport::AirportAvailable(AirportType type)
    28 {
    28 {
    29 	if (type > AT_HELISTATION) return 0;
    29 	if (type > AT_HELISTATION) return false;
    30 	return HasBit(::GetValidAirports(), type);
    30 	return HasBit(::GetValidAirports(), type);
    31 }
    31 }
    32 
    32 
    33 /* static */ int32 AIAirport::GetAirportWidth(AirportType type)
    33 /* static */ int32 AIAirport::GetAirportWidth(AirportType type)
    34 {
    34 {
    35 	if (type > AT_HELISTATION) return 0;
    35 	if (type > AT_HELISTATION) return -1;
    36 	return ::GetAirport(type)->size_x;
    36 	return ::GetAirport(type)->size_x;
    37 }
    37 }
    38 
    38 
    39 /* static */ int32 AIAirport::GetAirportHeight(AirportType type)
    39 /* static */ int32 AIAirport::GetAirportHeight(AirportType type)
    40 {
    40 {
    41 	if (type > AT_HELISTATION) return 0;
    41 	if (type > AT_HELISTATION) return -1;
    42 	return ::GetAirport(type)->size_y;
    42 	return ::GetAirport(type)->size_y;
    43 }
    43 }
    44 
    44 
    45 /* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
    45 /* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
    46 {
    46 {
    47 	if (type > AT_HELISTATION) return 0;
    47 	if (type > AT_HELISTATION) return -1;
    48 	return _patches.modified_catchment ? ::GetAirport(type)->catchment : (uint)CA_UNMODIFIED;
    48 	return _patches.modified_catchment ? ::GetAirport(type)->catchment : (uint)CA_UNMODIFIED;
    49 }
    49 }
    50 
    50 
    51 /* static */ bool AIAirport::BuildAirport(TileIndex tile, AirportType type)
    51 /* static */ bool AIAirport::BuildAirport(TileIndex tile, AirportType type)
    52 {
    52 {