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
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
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
     3
/** @file ai_airport.hpp Everything to query and build airports */
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:
9669
366771e15a2c (svn r10608) [NoAI] -Documentation: comment some functions to make Doxygen happy
truelight
parents: 9654
diff changeset
    15
	/**
366771e15a2c (svn r10608) [NoAI] -Documentation: comment some functions to make Doxygen happy
truelight
parents: 9654
diff changeset
    16
	 * 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
    17
	 */
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    18
	enum AirportType {
9681
3997f1ce203a (svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel
truelight
parents: 9670
diff changeset
    19
		/* Note: the values _are_ important as they represent an in-game value */
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    20
		AT_SMALL         =   0,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    21
		AT_LARGE         =   1,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    22
		AT_HELIPORT      =   2,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    23
		AT_METROPOLITAN  =   3,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    24
		AT_INTERNATIONAL =   4,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    25
		AT_COMMUTER      =   5,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    26
		AT_HELIDEPOT     =   6,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    27
		AT_INTERCON      =   7,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    28
		AT_HELISTATION   =   8,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    29
	};
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    30
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    31
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    32
	 * The name of the class, needed by several sub-processes.
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
	static const char *GetClassName() { return "AIAirport"; }
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
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    37
	 * Checks whether the given tile is actually a tile with a hangar.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    38
	 * @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
    39
	 * @pre AIMap::IsValidTile(tile).
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    40
	 * @return true if and only if the tile has a hangar.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    41
	 */
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    42
	static bool IsHangarTile(TileIndex tile);
9654
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
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    45
	 * Checks whether the given tile is actually a tile with a airport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    46
	 * @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
    47
	 * @pre AIMap::IsValidTile(tile).
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    48
	 * @return true if and only if the tile has a airport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    49
	 */
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    50
	static bool IsAirportTile(TileIndex tile);
9654
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
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    53
	 * Check if a certain airport type is already available.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    54
	 * @param type the type of airport to check.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    55
	 */
9773
d2c20cd38f18 (svn r12266) [NoAI] -Fix: [API CHANGE] minor typo in Ai*r*portAvailable (tnx yorick)
truebrain
parents: 9737
diff changeset
    56
	static bool AirportAvailable(AirportType type);
9670
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
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    59
	 * Get the width of this type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    60
	 * @param type the type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    61
	 * @return the width in tiles.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    62
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    63
	static int32 GetAirportWidth(AirportType type);
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
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    66
	 * Get the height of this type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    67
	 * @param type the type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    68
	 * @return the height in tiles.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    69
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    70
	static int32 GetAirportHeight(AirportType type);
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
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    73
	 * Get the coverage radius of this type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    74
	 * @param type the type of airport.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    75
	 * @return the radius in tiles.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    76
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9669
diff changeset
    77
	static int32 GetAirportCoverageRadius(AirportType type);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    78
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    79
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    80
	 * Builds a airport with tile at the topleft corner.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    81
	 * @param tile the topleft corner of the airport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    82
	 * @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
    83
	 * @pre AIMap::IsValidTile(tile).
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    84
	 * @return whether the airport has been/can be build or not.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    85
	 */
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
    86
	static bool BuildAirport(TileIndex tile, AirportType type);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    87
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    88
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    89
	 * Removes a airport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    90
	 * @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
    91
	 * @pre AIMap::IsValidTile(tile).
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    92
	 * @return whether the airport has been/can be removed or not.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    93
	 */
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
    94
	static bool RemoveAirport(TileIndex tile);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    95
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    96
	/**
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    97
	 * Get the first hanger tile of the airport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
    98
	 * @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
    99
	 * @pre AIMap::IsValidTile(tile).
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents:
diff changeset
   100
	 * @return the first hanger tile of the airport.
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 TileIndex GetHangarOfAirport(TileIndex tile);
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
#endif /* AI_AIRPORT_HPP */