author | rubidium |
Sun, 06 Apr 2008 12:26:40 +0000 | |
branch | noai |
changeset 9867 | b7d9ffe24f81 |
parent 9842 | ef007135fa47 |
child 10089 | e351169bf3a5 |
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" |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
9 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
10 |
/** |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
11 |
* Class that handles all tile related functions. |
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 AITile : public AIObject { |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
14 |
public: |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9814
diff
changeset
|
15 |
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
|
16 |
|
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
17 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
18 |
* 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
|
19 |
* |
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
|
20 |
* 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
|
21 |
* 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
|
22 |
* 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
|
23 |
*/ |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
24 |
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
|
25 |
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
|
26 |
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
|
27 |
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
|
28 |
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
|
29 |
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
}; |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
47 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
48 |
/** |
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
|
49 |
* 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
|
50 |
* 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
|
51 |
* @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
|
52 |
* @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
|
53 |
* @return True if it is buildable, false if not. |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
54 |
* @note Road and rail are considered buildable. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
55 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
56 |
static bool IsBuildable(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
57 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
58 |
/** |
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
|
59 |
* 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
|
60 |
* 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
|
61 |
* @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
|
62 |
* @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
|
63 |
* @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
|
64 |
* @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
|
65 |
* @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
|
66 |
* @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
|
67 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
68 |
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
|
69 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
70 |
/** |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
71 |
* 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
|
72 |
* @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
|
73 |
* @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
|
74 |
* @return True if it is water, false if not. |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
75 |
*/ |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
76 |
static bool IsWater(TileIndex tile); |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
77 |
|
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
78 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
79 |
* 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
|
80 |
* @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
|
81 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
82 |
* @return 0 means flat, others indicate internal state of slope. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
83 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
84 |
static int32 GetSlope(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
85 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
86 |
/** |
9700
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
87 |
* 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
|
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 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
|
91 |
*/ |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
92 |
static int32 GetHeight(TileIndex tile); |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
93 |
|
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
94 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
95 |
* Check how much cargo this tile accepts. |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
96 |
* 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
|
97 |
* 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
|
98 |
* @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
|
99 |
* @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
|
100 |
* @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
|
101 |
* @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
|
102 |
* @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
|
103 |
* @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
|
104 |
* @return Value below 8 means no acceptance; the more the better. |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
105 |
*/ |
9658
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
106 |
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
|
107 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
108 |
/** |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
109 |
* Checks how many tiles in the radius produces this cargo. |
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
110 |
* 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
|
111 |
* 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
|
112 |
* @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
|
113 |
* @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
|
114 |
* @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
|
115 |
* @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
|
116 |
* @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
|
117 |
* @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
|
118 |
* @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
|
119 |
* @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
|
120 |
*/ |
9735
9f06148355f4
(svn r12214) [NoAI] -Fix: 'rad' -> 'radius' for consistancy reasons
truebrain
parents:
9729
diff
changeset
|
121 |
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
|
122 |
|
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
123 |
/** |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
124 |
* 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
|
125 |
* @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
|
126 |
* @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
|
127 |
* @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
|
128 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
129 |
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
|
130 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
131 |
/** |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
132 |
* 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
|
133 |
* @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
|
134 |
* @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
|
135 |
* @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
|
136 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
137 |
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
|
138 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
139 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
140 |
* 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
|
141 |
* 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
|
142 |
* @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
|
143 |
* @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
|
144 |
* @pre AIMap::IsValidTile(tile). |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
145 |
* @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
|
146 |
*/ |
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
|
147 |
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
|
148 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
149 |
/** |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
150 |
* 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
|
151 |
* 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
|
152 |
* @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
|
153 |
* @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
|
154 |
* @pre AIMap::IsValidTile(tile). |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
155 |
* @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
|
156 |
*/ |
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
|
157 |
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
|
158 |
|
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
|
159 |
/** |
9abe20fc83e5
(svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents:
9829
diff
changeset
|
160 |
* 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
|
161 |
* @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
|
162 |
* @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
|
163 |
* @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
|
164 |
*/ |
9abe20fc83e5
(svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents:
9829
diff
changeset
|
165 |
static bool DemolishTile(TileIndex tile); |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
166 |
}; |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
167 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
168 |
#endif /* AI_TILE_HPP */ |