truelight@9654: /* $Id$ */ truelight@9654: truebrain@9829: /** @file ai_airport.hpp Everything to query and build airports. */ truelight@9654: truelight@9654: #ifndef AI_AIRPORT_HPP truelight@9654: #define AI_AIRPORT_HPP truelight@9654: truelight@9654: #include "ai_object.hpp" truelight@9654: truelight@9654: /** truelight@9654: * Class that handles all airport related functions. truelight@9654: */ truelight@9654: class AIAirport : public AIObject { truelight@9654: public: truebrain@9829: static const char *GetClassName() { return "AIAirport"; } truebrain@9829: truelight@9669: /** truelight@9669: * The types of airports available in the game. truelight@9669: */ truelight@9654: enum AirportType { truelight@9681: /* Note: the values _are_ important as they represent an in-game value */ truebrain@9835: AT_SMALL = 0, //!< The small airport. truebrain@9835: AT_LARGE = 1, //!< The large airport. truebrain@9835: AT_METROPOLITAN = 3, //!< The metropolitan airport. truebrain@9835: AT_INTERNATIONAL = 4, //!< The international airport. truebrain@9835: AT_COMMUTER = 5, //!< The commuter airport. truebrain@9835: AT_INTERCON = 7, //!< The intercontinental airport. truebrain@9835: truebrain@9835: /* Next are the airports which only have helicopter platforms */ truebrain@9835: AT_HELIPORT = 2, //!< The heliport. truebrain@9835: AT_HELISTATION = 8, //!< The helistation. truebrain@9835: AT_HELIDEPOT = 6, //!< The helidepot. truelight@9654: }; truelight@9654: truelight@9654: /** truelight@9654: * Checks whether the given tile is actually a tile with a hangar. truebrain@9835: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9835: * @return True if and only if the tile has a hangar. truelight@9654: */ truelight@9670: static bool IsHangarTile(TileIndex tile); truelight@9654: truelight@9654: /** truelight@9654: * Checks whether the given tile is actually a tile with a airport. truebrain@9835: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9835: * @return True if and only if the tile has a airport. truelight@9654: */ truelight@9670: static bool IsAirportTile(TileIndex tile); truelight@9654: truelight@9654: /** truelight@9654: * Check if a certain airport type is already available. truebrain@9835: * @param type The type of airport to check. truelight@9654: */ truebrain@9773: static bool AirportAvailable(AirportType type); truelight@9670: truelight@9670: /** truelight@9670: * Get the width of this type of airport. truebrain@9835: * @param type The type of airport. truebrain@9835: * @return The width in tiles. truelight@9670: */ truelight@9670: static int32 GetAirportWidth(AirportType type); truelight@9670: truelight@9670: /** truelight@9670: * Get the height of this type of airport. truebrain@9835: * @param type The type of airport. truebrain@9835: * @return The height in tiles. truelight@9670: */ truelight@9670: static int32 GetAirportHeight(AirportType type); truelight@9670: truelight@9670: /** truelight@9670: * Get the coverage radius of this type of airport. truebrain@9835: * @param type The type of airport. truebrain@9835: * @return The radius in tiles. truelight@9670: */ truelight@9670: static int32 GetAirportCoverageRadius(AirportType type); truelight@9654: truelight@9654: /** truebrain@9829: * Get the first hanger tile of the airport. truebrain@9835: * @param tile Any tile of the airport. truebrain@9829: * @pre AIMap::IsValidTile(tile). truebrain@9835: * @return The first hanger tile of the airport. truebrain@9835: * @note Possible there are more hangars, but you won't be able to find them truebrain@9835: * without walking over all the tiles of the airport and using truebrain@9835: * IsHangarTile() on them. truebrain@9829: */ truebrain@9829: static TileIndex GetHangarOfAirport(TileIndex tile); truebrain@9829: truebrain@9829: /** truelight@9654: * Builds a airport with tile at the topleft corner. truebrain@9835: * @param tile The topleft corner of the airport. truebrain@9835: * @param type The type of airport to build. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@9866: * @pre AirportAvailable(type). rubidium@9866: * @exception AIError::ERR_AREA_NOT_CLEAR rubidium@9866: * @exception AIError::ERR_FLAT_LAND_REQUIRED rubidium@9866: * @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES rubidium@9866: * @exception AIStation::ERR_STATION_TOO_LARGE rubidium@9866: * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION truebrain@9835: * @return Whether the airport has been/can be build or not. truelight@9654: */ truebrain@9737: static bool BuildAirport(TileIndex tile, AirportType type); truelight@9654: truelight@9654: /** truelight@9654: * Removes a airport. truebrain@9835: * @param tile Any tile of the airport. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@9866: * @exception AIError::ERR_AREA_IS_OWNED_BY_ANOTHER_COMPANY truebrain@9835: * @return Whether the airport has been/can be removed or not. truelight@9654: */ truebrain@9737: static bool RemoveAirport(TileIndex tile); truelight@9654: }; truelight@9654: truelight@9654: #endif /* AI_AIRPORT_HPP */