src/ai/api/ai_tile.hpp
author rubidium
Sat, 12 Apr 2008 21:38:49 +0000
branchnoai
changeset 10142 56ee7da4ad56
parent 10094 e737405b06dd
child 10191 da75d1460a4b
permissions -rw-r--r--
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     1
/* $Id$ */
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
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: 9814
diff changeset
     3
/** @file ai_tile.hpp Everything to query and manipulate tiles. */
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     4
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     5
#ifndef AI_TILE_HPP
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     6
#define AI_TILE_HPP
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     7
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
     8
#include "ai_abstractlist.hpp"
10089
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
     9
#include "ai_error.hpp"
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    10
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    11
/**
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    12
 * Class that handles all tile related functions.
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    13
 */
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    14
class AITile : public AIObject {
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    15
public:
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9814
diff changeset
    16
	static const char *GetClassName() { return "AITile"; }
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9814
diff changeset
    17
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    18
	/**
10089
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    19
	 * Error messages related to modifying tiles.
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    20
	 */
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    21
	enum ErrorMessages {
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    22
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    23
		/** Base for tile related errors */
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    24
		ERR_TILE_BASE = AIError::ERR_CAT_TILE << AIError::ERR_CAT_BIT_SIZE,
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    25
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    26
		/** Tile can't be raised any higher */
10094
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
    27
		ERR_TILE_TOO_HIGH,                     // [STR_1003_ALREADY_AT_SEA_LEVEL]
10089
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    28
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    29
		/** Tile can't be lowered any lower */
10094
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
    30
		ERR_TILE_TOO_LOW,                      // [STR_1003_ALREADY_AT_SEA_LEVEL]
10089
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    31
	};
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    32
e351169bf3a5 (svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents: 9842
diff changeset
    33
	/**
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    34
	 * Enumeration for the slope-type (from slopes.h).
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    35
	 *
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    36
	 * This enumeration use the chars N, E, S, W corresponding the
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    37
	 *  direction North, East, South and West. The top corner of a tile
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    38
	 *  is the north-part of the tile.
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    39
	 */
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    40
	enum Slope {
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    41
		SLOPE_FLAT     = 0x00,                                  //!< A flat tile
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    42
		SLOPE_W        = 0x01,                                  //!< The west corner of the tile is raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    43
		SLOPE_S        = 0x02,                                  //!< The south corner of the tile is raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    44
		SLOPE_E        = 0x04,                                  //!< The east corner of the tile is raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    45
		SLOPE_N        = 0x08,                                  //!< The north corner of the tile is raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    46
		SLOPE_STEEP    = 0x10,                                  //!< Indicates the slope is steep
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    47
		SLOPE_NW       = SLOPE_N | SLOPE_W,                     //!< North and west corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    48
		SLOPE_SW       = SLOPE_S | SLOPE_W,                     //!< South and west corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    49
		SLOPE_SE       = SLOPE_S | SLOPE_E,                     //!< South and east corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    50
		SLOPE_NE       = SLOPE_N | SLOPE_E,                     //!< North and east corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    51
		SLOPE_EW       = SLOPE_E | SLOPE_W,                     //!< East and west corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    52
		SLOPE_NS       = SLOPE_N | SLOPE_S,                     //!< North and south corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    53
		SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, //!< All corner are raised, similar to SLOPE_FLAT
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    54
		SLOPE_NWS      = SLOPE_N | SLOPE_W | SLOPE_S,           //!< North, west and south corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    55
		SLOPE_WSE      = SLOPE_W | SLOPE_S | SLOPE_E,           //!< West, south and east corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    56
		SLOPE_SEN      = SLOPE_S | SLOPE_E | SLOPE_N,           //!< South, east and north corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    57
		SLOPE_ENW      = SLOPE_E | SLOPE_N | SLOPE_W,           //!< East, north and west corner are raised
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    58
		SLOPE_STEEP_W  = SLOPE_STEEP | SLOPE_NWS,               //!< A steep slope falling to east (from west)
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    59
		SLOPE_STEEP_S  = SLOPE_STEEP | SLOPE_WSE,               //!< A steep slope falling to north (from south)
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    60
		SLOPE_STEEP_E  = SLOPE_STEEP | SLOPE_SEN,               //!< A steep slope falling to west (from east)
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    61
		SLOPE_STEEP_N  = SLOPE_STEEP | SLOPE_ENW                //!< A steep slope falling to south (from north)
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    62
	};
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    63
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
    64
	/**
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    65
	 * Check if this tile is buildable, i.e. no things on it that needs
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    66
	 *  demolishing.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    67
	 * @param tile The tile to check on.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    68
	 * @pre AIMap::IsValidTile(tile).
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    69
	 * @return True if it is buildable, false if not.
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    70
	 * @note Road and rail are considered buildable.
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    71
	 */
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    72
	static bool IsBuildable(TileIndex tile);
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    73
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    74
	/**
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    75
	 * Check if this tile is buildable in a rectangle around a tile, with the
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    76
	 *  entry in the list as top-left.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    77
	 * @param tile The tile to check on.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    78
	 * @param width The width of the rectangle.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    79
	 * @param height The height of the rectangle.
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
    80
	 * @pre AIMap::IsValidTile(tile).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    81
	 * @return True if it is buildable, false if not.
9842
ef007135fa47 (svn r12508) [NoAI] -Fix: @note that refer to @return should come after @return, not before @param
truebrain
parents: 9838
diff changeset
    82
	 * @note Road and rail are considered buildable.
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
    83
	 */
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
    84
	static bool IsBuildableRectangle(TileIndex tile, uint width, uint height);
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
    85
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
    86
	/**
9698
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9658
diff changeset
    87
	 * Check if a tile is water.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    88
	 * @param tile The tile to check on.
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: 9771
diff changeset
    89
	 * @pre AIMap::IsValidTile(tile).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    90
	 * @return True if it is water, false if not.
9698
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9658
diff changeset
    91
	 */
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9658
diff changeset
    92
	static bool IsWater(TileIndex tile);
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9658
diff changeset
    93
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9658
diff changeset
    94
	/**
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    95
	 * Get the slope of a tile.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
    96
	 * @param tile The tile to check on.
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: 9771
diff changeset
    97
	 * @pre AIMap::IsValidTile(tile).
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    98
	 * @return 0 means flat, others indicate internal state of slope.
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
    99
	 */
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   100
	static int32 GetSlope(TileIndex tile);
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   101
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   102
	/**
9700
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9698
diff changeset
   103
	 * Get the height of the tile.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   104
	 * @param tile The tile to check on.
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: 9771
diff changeset
   105
	 * @pre AIMap::IsValidTile(tile).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   106
	 * @return The height of the tile, ranging from 0 to 15.
9700
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9698
diff changeset
   107
	 */
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9698
diff changeset
   108
	static int32 GetHeight(TileIndex tile);
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9698
diff changeset
   109
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9698
diff changeset
   110
	/**
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   111
	 * Check how much cargo this tile accepts.
9771
769496a7b02e (svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents: 9737
diff changeset
   112
	 *  It creates a radius around the tile, and adds up all acceptance of this
769496a7b02e (svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents: 9737
diff changeset
   113
	 *   cargo.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   114
	 * @param tile The tile to check on.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   115
	 * @param cargo_type The cargo to check the acceptance of.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   116
	 * @param width The width of the station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   117
	 * @param height The height of the station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   118
	 * @param radius The radius of the station.
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: 9771
diff changeset
   119
	 * @pre AIMap::IsValidTile(tile).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   120
	 * @return Value below 8 means no acceptance; the more the better.
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   121
	 */
9658
e7675771bca4 (svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents: 9619
diff changeset
   122
	static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   123
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   124
	/**
9771
769496a7b02e (svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents: 9737
diff changeset
   125
	 * Checks how many tiles in the radius produces this cargo.
769496a7b02e (svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents: 9737
diff changeset
   126
	 *  It creates a radius around the tile, and adds up all tiles that produce
769496a7b02e (svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents: 9737
diff changeset
   127
	 *  this cargo.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   128
	 * @param tile The tile to check on.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   129
	 * @param cargo_type The cargo to check the production of.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   130
	 * @param width The width of the station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   131
	 * @param height The height of the station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   132
	 * @param radius The radius of the station.
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: 9771
diff changeset
   133
	 * @pre AIMap::IsValidTile(tile).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   134
	 * @return The tiles that produce this cargo within radius of the tile.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   135
	 * @note Town(houses) are not included in the value.
9729
c264c78a3567 (svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents: 9708
diff changeset
   136
	 */
9735
9f06148355f4 (svn r12214) [NoAI] -Fix: 'rad' -> 'radius' for consistancy reasons
truebrain
parents: 9729
diff changeset
   137
	static int32 GetCargoProduction(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
9729
c264c78a3567 (svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents: 9708
diff changeset
   138
c264c78a3567 (svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents: 9708
diff changeset
   139
	/**
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   140
	 * Get the manhattan distance from the tile to the tile.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   141
	 * @param tile_from The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   142
	 * @param tile_to The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   143
	 * @return The distance between the two tiles.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   144
	 */
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   145
	static int32 GetDistanceManhattanToTile(TileIndex tile_from, TileIndex tile_to);
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   146
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   147
	/**
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   148
	 * Get the square distance from the tile to the tile.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   149
	 * @param tile_from The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   150
	 * @param tile_to The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   151
	 * @return The distance between the two tiles.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   152
	 */
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   153
	static int32 GetDistanceSquareToTile(TileIndex tile_from, TileIndex tile_to);
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   154
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9801
diff changeset
   155
	/**
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   156
	 * Raise the given corners of the tile. The corners can be combined,
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   157
	 *  for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   158
	 * @param tile The tile to raise.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   159
	 * @param slope Corners to raise (SLOPE_xxx).
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: 9771
diff changeset
   160
	 * @pre AIMap::IsValidTile(tile).
10094
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   161
	 * @exception AIError::ERR_AREA_NOT_CLEAR
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   162
	 * @exception AIError::ERR_TOO_CLOSE_TO_EDGE
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   163
	 * @exception AITile::ERR_TILE_TOO_HIGH
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   164
	 * @return 0 means failed, 1 means success.
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   165
	 */
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: 9735
diff changeset
   166
	static bool RaiseTile(TileIndex tile, int32 slope);
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   167
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   168
	/**
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   169
	 * Lower the given corners of the tile. The corners can be combined,
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   170
	 *  for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   171
	 * @param tile The tile to lower.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   172
	 * @param slope Corners to lower (SLOPE_xxx).
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: 9771
diff changeset
   173
	 * @pre AIMap::IsValidTile(tile).
10094
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   174
	 * @exception AIError::ERR_AREA_NOT_CLEAR
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   175
	 * @exception AIError::ERR_TOO_CLOSE_TO_EDGE
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   176
	 * @exception AITile::ERR_TILE_TOO_LOW
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   177
	 * @return 0 means failed, 1 means success.
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   178
	 */
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: 9735
diff changeset
   179
	static bool LowerTile(TileIndex tile, int32 slope);
9708
a63a756fd080 (svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents: 9700
diff changeset
   180
9834
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9829
diff changeset
   181
	/**
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9829
diff changeset
   182
	 * Destroy everything on the given tile.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   183
	 * @param tile The tile to demolish.
9834
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9829
diff changeset
   184
	 * @pre AIMap::IsValidTile(tile).
10094
e737405b06dd (svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents: 10089
diff changeset
   185
	 * @exception AIError::ERR_AREA_NOT_CLEAR
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9834
diff changeset
   186
	 * @return True if and only if the tile was demolished.
9834
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9829
diff changeset
   187
	 */
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9829
diff changeset
   188
	static bool DemolishTile(TileIndex tile);
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   189
};
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   190
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff changeset
   191
#endif /* AI_TILE_HPP */