author | truebrain |
Fri, 25 Apr 2008 15:51:12 +0000 | |
branch | noai |
changeset 10360 | 3234cb59de55 |
parent 10191 | da75d1460a4b |
child 10848 | 7816f447a0ed |
permissions | -rw-r--r-- |
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" |
10360
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
10 |
#include "ai_company.hpp" |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
11 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
12 |
/** |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
13 |
* Class that handles all tile related functions. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
14 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
15 |
class AITile : public AIObject { |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
16 |
public: |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9814
diff
changeset
|
17 |
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
|
18 |
|
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
19 |
/** |
10089
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
20 |
* Error messages related to modifying tiles. |
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
21 |
*/ |
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
22 |
enum ErrorMessages { |
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
23 |
|
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
24 |
/** Base for tile related errors */ |
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
25 |
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
|
26 |
|
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
27 |
/** 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
|
28 |
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
|
29 |
|
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
30 |
/** 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
|
31 |
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
|
32 |
}; |
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
33 |
|
e351169bf3a5
(svn r12613) [NoAI] -Add: support for GetLastError in AITile. Patch by Morloth.
rubidium
parents:
9842
diff
changeset
|
34 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
35 |
* 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
|
36 |
* |
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
|
37 |
* 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
|
38 |
* 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
|
39 |
* 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
|
40 |
*/ |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, //!< A steep slope falling to west (from east) |
10191
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
62 |
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, //!< A steep slope falling to south (from north) |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
63 |
|
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
64 |
SLOPE_INVALID = 0xFF, //!< An invalid slope |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
65 |
}; |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
66 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
67 |
/** |
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
|
68 |
* 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
|
69 |
* 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
|
70 |
* @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
|
71 |
* @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
|
72 |
* @return True if it is buildable, false if not. |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
73 |
* @note Road and rail are considered buildable. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
74 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
75 |
static bool IsBuildable(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
76 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
77 |
/** |
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
|
78 |
* 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
|
79 |
* 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
|
80 |
* @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
|
81 |
* @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
|
82 |
* @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
|
83 |
* @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
|
84 |
* @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
|
85 |
* @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
|
86 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
87 |
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
|
88 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
89 |
/** |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
90 |
* 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
|
91 |
* @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
|
92 |
* @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
|
93 |
* @return True if it is water, false if not. |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
94 |
*/ |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
95 |
static bool IsWater(TileIndex tile); |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
96 |
|
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
97 |
/** |
10191
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
98 |
* Check if a tile has a steep slope. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
99 |
* @param slope The slope to check on. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
100 |
* @pre slope != SLOPE_INVALID. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
101 |
* @return True if the slope is a steep slope. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
102 |
*/ |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
103 |
static bool IsSteepSlope(Slope slope); |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
104 |
|
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
105 |
/** |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
106 |
* Check if a tile has a halftile slope. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
107 |
* @param slope The slope to check on. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
108 |
* @pre slope != SLOPE_INVALID. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
109 |
* @return True if the slope is a halftile slope. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
110 |
*/ |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
111 |
static bool IsHalftileSlope(Slope slope); |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
112 |
|
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
113 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
114 |
* 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
|
115 |
* @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
|
116 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
117 |
* @return 0 means flat, others indicate internal state of slope. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
118 |
*/ |
10191
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
119 |
static Slope GetSlope(TileIndex tile); |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
120 |
|
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
121 |
/** |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
122 |
* Get the complement of the slope. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
123 |
* @param slope The slope to get the complement of. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
124 |
* @pre slope != SLOPE_INVALID. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
125 |
* @pre !IsSteepSlope(slope). |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
126 |
* @pre !IsHalftileSlope(slope). |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
127 |
* @return The complement of a slope. This means that all corners that |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
128 |
* weren't raised, are raised, and visa versa. |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
129 |
*/ |
da75d1460a4b
(svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents:
10094
diff
changeset
|
130 |
static Slope GetComplementSlope(Slope slope); |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
131 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
132 |
/** |
9700
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
133 |
* 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
|
134 |
* @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
|
135 |
* @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
|
136 |
* @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
|
137 |
*/ |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
138 |
static int32 GetHeight(TileIndex tile); |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
139 |
|
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
140 |
/** |
10360
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
141 |
* Get the owner of the tile. |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
142 |
* @param tile The tile to get the owner from. |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
143 |
* @pre AIMap::IsValidTile(tile). |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
144 |
* @return The CompanyIndex of the owner of the tile, or INVALID_COMPANY if |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
145 |
* there is no owner (grass/industry/water tiles, etc.). |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
146 |
*/ |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
147 |
static AICompany::CompanyIndex GetOwner(TileIndex tile); |
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
148 |
|
3234cb59de55
(svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents:
10191
diff
changeset
|
149 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
150 |
* Check how much cargo this tile accepts. |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
151 |
* 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
|
152 |
* 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
|
153 |
* @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
|
154 |
* @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
|
155 |
* @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
|
156 |
* @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
|
157 |
* @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
|
158 |
* @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
|
159 |
* @return Value below 8 means no acceptance; the more the better. |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
160 |
*/ |
9658
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
161 |
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
|
162 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
163 |
/** |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
164 |
* Checks how many tiles in the radius produces this cargo. |
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
165 |
* 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
|
166 |
* 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
|
167 |
* @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
|
168 |
* @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
|
169 |
* @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
|
170 |
* @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
|
171 |
* @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
|
172 |
* @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
|
173 |
* @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
|
174 |
* @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
|
175 |
*/ |
9735
9f06148355f4
(svn r12214) [NoAI] -Fix: 'rad' -> 'radius' for consistancy reasons
truebrain
parents:
9729
diff
changeset
|
176 |
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
|
177 |
|
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
178 |
/** |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
179 |
* 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
|
180 |
* @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
|
181 |
* @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
|
182 |
* @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
|
183 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
184 |
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
|
185 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
186 |
/** |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
187 |
* 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
|
188 |
* @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
|
189 |
* @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
|
190 |
* @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
|
191 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
192 |
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
|
193 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
194 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
195 |
* 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
|
196 |
* 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
|
197 |
* @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
|
198 |
* @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
|
199 |
* @pre AIMap::IsValidTile(tile). |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10089
diff
changeset
|
200 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10089
diff
changeset
|
201 |
* @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
|
202 |
* @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
|
203 |
* @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
|
204 |
*/ |
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
|
205 |
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
|
206 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
207 |
/** |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
208 |
* 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
|
209 |
* 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
|
210 |
* @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
|
211 |
* @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
|
212 |
* @pre AIMap::IsValidTile(tile). |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10089
diff
changeset
|
213 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10089
diff
changeset
|
214 |
* @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
|
215 |
* @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
|
216 |
* @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
|
217 |
*/ |
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
|
218 |
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
|
219 |
|
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
|
220 |
/** |
9abe20fc83e5
(svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents:
9829
diff
changeset
|
221 |
* 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
|
222 |
* @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
|
223 |
* @pre AIMap::IsValidTile(tile). |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10089
diff
changeset
|
224 |
* @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
|
225 |
* @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
|
226 |
*/ |
9abe20fc83e5
(svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents:
9829
diff
changeset
|
227 |
static bool DemolishTile(TileIndex tile); |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
228 |
}; |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
229 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
230 |
#endif /* AI_TILE_HPP */ |