src/ai/api/ai_airport.hpp
author rubidium
Fri, 04 Apr 2008 10:43:13 +0000
branchnoai
changeset 9866 efc38e1f559a
parent 9835 2541c2d325ed
child 10091 e4feb2f9fedf
permissions -rw-r--r--
(svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     1
/* $Id$ */
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     2
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
     3
/** @file ai_airport.hpp Everything to query and build airports. */
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     4
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     5
#ifndef AI_AIRPORT_HPP
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     6
#define AI_AIRPORT_HPP
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     7
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     8
#include "ai_object.hpp"
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     9
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    10
/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    11
 * Class that handles all airport related functions.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    12
 */
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    13
class AIAirport : public AIObject {
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    14
public:
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    15
	static const char *GetClassName() { return "AIAirport"; }
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    16
9669
366771e15a2c (svn r10608) [NoAI] -Documentation: comment some functions to make Doxygen happy
truelight
parents: 9654
diff changeset
    17
	/**
366771e15a2c (svn r10608) [NoAI] -Documentation: comment some functions to make Doxygen happy
truelight
parents: 9654
diff changeset
    18
	 * The types of airports available in the game.
366771e15a2c (svn r10608) [NoAI] -Documentation: comment some functions to make Doxygen happy
truelight
parents: 9654
diff changeset
    19
	 */
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    20
	enum AirportType {
9681
3997f1ce203a (svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel
truelight
parents: 9670
diff changeset
    21
		/* Note: the values _are_ important as they represent an in-game value */
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    22
		AT_SMALL         =   0, //!< The small airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    23
		AT_LARGE         =   1, //!< The large airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    24
		AT_METROPOLITAN  =   3, //!< The metropolitan airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    25
		AT_INTERNATIONAL =   4, //!< The international airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    26
		AT_COMMUTER      =   5, //!< The commuter airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    27
		AT_INTERCON      =   7, //!< The intercontinental airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    28
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    29
		/* Next are the airports which only have helicopter platforms */
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    30
		AT_HELIPORT      =   2, //!< The heliport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    31
		AT_HELISTATION   =   8, //!< The helistation.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    32
		AT_HELIDEPOT     =   6, //!< The helidepot.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    33
	};
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    34
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    35
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    36
	 * Checks whether the given tile is actually a tile with a hangar.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    37
	 * @param tile The tile to check.
9801
03a3eebd7fb7 (svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents: 9773
diff changeset
    38
	 * @pre AIMap::IsValidTile(tile).
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    39
	 * @return True if and only if the tile has a hangar.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    40
	 */
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    41
	static bool IsHangarTile(TileIndex tile);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    42
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    43
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    44
	 * Checks whether the given tile is actually a tile with a airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    45
	 * @param tile The tile to check.
9801
03a3eebd7fb7 (svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents: 9773
diff changeset
    46
	 * @pre AIMap::IsValidTile(tile).
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    47
	 * @return True if and only if the tile has a airport.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    48
	 */
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    49
	static bool IsAirportTile(TileIndex tile);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    50
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    51
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    52
	 * Check if a certain airport type is already available.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    53
	 * @param type The type of airport to check.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    54
	 */
9773
d2c20cd38f18 (svn r12266) [NoAI] -Fix: [API CHANGE] minor typo in Ai*r*portAvailable (tnx yorick)
truebrain
parents: 9737
diff changeset
    55
	static bool AirportAvailable(AirportType type);
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    56
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    57
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    58
	 * Get the width of this type of airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    59
	 * @param type The type of airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    60
	 * @return The width in tiles.
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    61
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    62
	static int32 GetAirportWidth(AirportType type);
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    63
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    64
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    65
	 * Get the height of this type of airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    66
	 * @param type The type of airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    67
	 * @return The height in tiles.
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    68
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    69
	static int32 GetAirportHeight(AirportType type);
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    70
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    71
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    72
	 * Get the coverage radius of this type of airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    73
	 * @param type The type of airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    74
	 * @return The radius in tiles.
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    75
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    76
	static int32 GetAirportCoverageRadius(AirportType type);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    77
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    78
	/**
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    79
	 * Get the first hanger tile of the airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    80
	 * @param tile Any tile of the airport.
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    81
	 * @pre AIMap::IsValidTile(tile).
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    82
	 * @return The first hanger tile of the airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    83
	 * @note Possible there are more hangars, but you won't be able to find them
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    84
	 *  without walking over all the tiles of the airport and using
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    85
	 *  IsHangarTile() on them.
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    86
	 */
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    87
	static TileIndex GetHangarOfAirport(TileIndex tile);
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    88
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9801
diff changeset
    89
	/**
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    90
	 * Builds a airport with tile at the topleft corner.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    91
	 * @param tile The topleft corner of the airport.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    92
	 * @param type The type of airport to build.
9801
03a3eebd7fb7 (svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents: 9773
diff changeset
    93
	 * @pre AIMap::IsValidTile(tile).
9866
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    94
	 * @pre AirportAvailable(type).
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    95
	 * @exception AIError::ERR_AREA_NOT_CLEAR
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    96
	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    97
	 * @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    98
	 * @exception AIStation::ERR_STATION_TOO_LARGE
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
    99
	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
   100
	 * @return Whether the airport has been/can be build or not.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   101
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9681
diff changeset
   102
	static bool BuildAirport(TileIndex tile, AirportType type);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   103
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   104
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   105
	 * Removes a airport.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
   106
	 * @param tile Any tile of the airport.
9801
03a3eebd7fb7 (svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents: 9773
diff changeset
   107
	 * @pre AIMap::IsValidTile(tile).
9866
efc38e1f559a (svn r12559) [NoAI] -Add: SetLastError support for AIAirport.
rubidium
parents: 9835
diff changeset
   108
	 * @exception AIError::ERR_AREA_IS_OWNED_BY_ANOTHER_COMPANY
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
   109
	 * @return Whether the airport has been/can be removed or not.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   110
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9681
diff changeset
   111
	static bool RemoveAirport(TileIndex tile);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   112
};
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   113
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   114
#endif /* AI_AIRPORT_HPP */