src/ai/api/ai_airport.hpp
author truelight
Sun, 19 Aug 2007 13:31:04 +0000
branchnoai
changeset 9698 1d50fe99b7e9
parent 9681 3997f1ce203a
child 9737 ee408edf3851
permissions -rw-r--r--
(svn r10939) [NoAI] -Add: added AITileList valuator Water
[NoAI] -Add: added AITile::IsWater
/* $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 tile is always positive and smaller than AIMap::GetMapSize().
	 * @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 tile is always positive and smaller than AIMap::GetMapSize().
	 * @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 AiportAvailable(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 tile is always positive and smaller than AIMap::GetMapSize().
	 * @return whether the airport has been/can be build or not.
	 */
	bool BuildAirport(TileIndex tile, AirportType type);

	/**
	 * Removes a airport.
	 * @param tile any tile of the airport.
	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
	 * @return whether the airport has been/can be removed or not.
	 */
	bool RemoveAirport(TileIndex tile);

	/**
	 * Get the first hanger tile of the airport.
	 * @param tile any tile of the airport.
	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
	 * @return the first hanger tile of the airport.
	 */
	TileIndex GetHangarOfAirport(TileIndex tile);
};

#endif /* AI_AIRPORT_HPP */