File diff r14848:8e2ba5b203eb → r14849:27386629fac1
src/ai/api/ai_airport.cpp
Show inline comments
 
@@ -87,49 +87,49 @@
 
	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 
}
 

	
 
/* static */ int32 AIAirport::GetNumHangars(TileIndex tile)
 
{
 
	if (!::IsValidTile(tile)) return -1;
 
	if (!::IsTileType(tile, MP_STATION)) return -1;
 

	
 
	const Station *st = ::Station::GetByTile(tile);
 
	if (st->owner != _current_company) return -1;
 
	if ((st->facilities & FACIL_AIRPORT) == 0) return -1;
 

	
 
	return st->GetAirportSpec()->nof_depots;
 
	return st->airport.GetSpec()->nof_depots;
 
}
 

	
 
/* static */ TileIndex AIAirport::GetHangarOfAirport(TileIndex tile)
 
{
 
	if (!::IsValidTile(tile)) return INVALID_TILE;
 
	if (!::IsTileType(tile, MP_STATION)) return INVALID_TILE;
 
	if (GetNumHangars(tile) < 1) return INVALID_TILE;
 

	
 
	const Station *st = ::Station::GetByTile(tile);
 
	if (st->owner != _current_company) return INVALID_TILE;
 
	if ((st->facilities & FACIL_AIRPORT) == 0) return INVALID_TILE;
 

	
 
	return st->GetHangarTile(0);
 
}
 

	
 
/* static */ AIAirport::AirportType AIAirport::GetAirportType(TileIndex tile)
 
{
 
	if (!AITile::IsStationTile(tile)) return AT_INVALID;
 

	
 
	StationID station_id = ::GetStationIndex(tile);
 

	
 
	if (!AIStation::HasStationType(station_id, AIStation::STATION_AIRPORT)) return AT_INVALID;
 

	
 
	return (AirportType)::Station::Get(station_id)->airport_type;
 
	return (AirportType)::Station::Get(station_id)->airport.type;
 
}
 

	
 

	
 
/* static */ int AIAirport::GetNoiseLevelIncrease(TileIndex tile, AirportType type)
 
{
 
	extern Town *AirportGetNearestTown(const AirportSpec *as, TileIndex airport_tile);
 
	extern uint8 GetAirportNoiseLevelForTown(const AirportSpec *as, TileIndex town_tile, TileIndex tile);
 

	
 
	if (!::IsValidTile(tile)) return -1;
 
	if (!IsValidAirportType(type)) return -1;
 

	
 
	if (_settings_game.economy.station_noise_level) {