src/ai/api/ai_airport.hpp
author truelight
Sat, 14 Jul 2007 21:15:49 +0000
branchnoai
changeset 9657 f2c6e332d8bc
parent 9654 b836eb5c521f
child 9669 366771e15a2c
permissions -rw-r--r--
(svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
/* $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:
	enum AirportType {
		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.
	 */
	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.
	 */
	bool IsAirportTile(TileIndex tile);

	/**
	 * Check if a certain airport type is already available.
	 * @param type the type of airport to check.
	 */
	bool AiportAvailable(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 */