src/ai/api/ai_airport.hpp
author truebrain
Wed, 26 Mar 2008 15:17:40 +0000
branchnoai
changeset 9823 0b7f816cf46f
parent 9801 03a3eebd7fb7
child 9829 80fbe02a4184
permissions -rw-r--r--
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
/* $Id$ */

/** @file ai_airport.hpp Everything to query and build airports */

#ifndef AI_AIRPORT_HPP
#define AI_AIRPORT_HPP

#include "ai_object.hpp"

/**
 * Class that handles all airport related functions.
 */
class AIAirport : public AIObject {
public:
	/**
	 * The types of airports available in the game.
	 */
	enum AirportType {
		/* Note: the values _are_ important as they represent an in-game value */
		AT_SMALL         =   0,
		AT_LARGE         =   1,
		AT_HELIPORT      =   2,
		AT_METROPOLITAN  =   3,
		AT_INTERNATIONAL =   4,
		AT_COMMUTER      =   5,
		AT_HELIDEPOT     =   6,
		AT_INTERCON      =   7,
		AT_HELISTATION   =   8,
	};

	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIAirport"; }

	/**
	 * Checks whether the given tile is actually a tile with a hangar.
	 * @param tile the tile to check.
	 * @pre AIMap::IsValidTile(tile).
	 * @return true if and only if the tile has a hangar.
	 */
	static bool IsHangarTile(TileIndex tile);

	/**
	 * Checks whether the given tile is actually a tile with a airport.
	 * @param tile the tile to check.
	 * @pre AIMap::IsValidTile(tile).
	 * @return true if and only if the tile has a airport.
	 */
	static bool IsAirportTile(TileIndex tile);

	/**
	 * Check if a certain airport type is already available.
	 * @param type the type of airport to check.
	 */
	static bool AirportAvailable(AirportType type);

	/**
	 * Get the width of this type of airport.
	 * @param type the type of airport.
	 * @return the width in tiles.
	 */
	static int32 GetAirportWidth(AirportType type);

	/**
	 * Get the height of this type of airport.
	 * @param type the type of airport.
	 * @return the height in tiles.
	 */
	static int32 GetAirportHeight(AirportType type);

	/**
	 * Get the coverage radius of this type of airport.
	 * @param type the type of airport.
	 * @return the radius in tiles.
	 */
	static int32 GetAirportCoverageRadius(AirportType type);

	/**
	 * Builds a airport with tile at the topleft corner.
	 * @param tile the topleft corner of the airport.
	 * @param type the type of airport to build.
	 * @pre AIMap::IsValidTile(tile).
	 * @return whether the airport has been/can be build or not.
	 */
	static bool BuildAirport(TileIndex tile, AirportType type);

	/**
	 * Removes a airport.
	 * @param tile any tile of the airport.
	 * @pre AIMap::IsValidTile(tile).
	 * @return whether the airport has been/can be removed or not.
	 */
	static bool RemoveAirport(TileIndex tile);

	/**
	 * Get the first hanger tile of the airport.
	 * @param tile any tile of the airport.
	 * @pre AIMap::IsValidTile(tile).
	 * @return the first hanger tile of the airport.
	 */
	static TileIndex GetHangarOfAirport(TileIndex tile);
};

#endif /* AI_AIRPORT_HPP */