author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9814 | be51ea0adc29 |
child 9829 | 80fbe02a4184 |
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 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
3 |
/** @file ai_tile.hpp tile related functions */ |
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: |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
15 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
16 |
* 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
|
17 |
* |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
18 |
* This enumeration use the chars N,E,S,W corresponding the |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
19 |
* direction north, east, south and west. The top corner of a tile |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
20 |
* is the north-part of the tile. The whole slope is encoded with |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
21 |
* 5 bits, 4 bits for each corner and 1 bit for a steep-flag. |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
22 |
*/ |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
23 |
enum Slope { |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
24 |
SLOPE_FLAT = 0x00, ///< a flat tile |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
25 |
SLOPE_W = 0x01, ///< the west corner of the tile is raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
26 |
SLOPE_S = 0x02, ///< the south corner of the tile is raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
27 |
SLOPE_E = 0x04, ///< the east corner of the tile is raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
28 |
SLOPE_N = 0x08, ///< the north corner of the tile is raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
29 |
SLOPE_STEEP = 0x10, ///< indicates the slope is steep |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
30 |
SLOPE_NW = SLOPE_N | SLOPE_W, ///< north and west corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
31 |
SLOPE_SW = SLOPE_S | SLOPE_W, ///< south and west corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
32 |
SLOPE_SE = SLOPE_S | SLOPE_E, ///< south and east corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
33 |
SLOPE_NE = SLOPE_N | SLOPE_E, ///< north and east corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
34 |
SLOPE_EW = SLOPE_E | SLOPE_W, ///< east and west corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
35 |
SLOPE_NS = SLOPE_N | SLOPE_S, ///< north and south corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
36 |
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, ///< all corner are raised, similar to SLOPE_FLAT |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
37 |
SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, ///< north, west and south corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
38 |
SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, ///< west, south and east corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
39 |
SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, ///< south, east and north corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
40 |
SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W, ///< east, north and west corner are raised |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
41 |
SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS, ///< a steep slope falling to east (from west) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
42 |
SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE, ///< a steep slope falling to north (from south) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
43 |
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, ///< a steep slope falling to west (from east) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
44 |
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW ///< a steep slope falling to south (from north) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
45 |
}; |
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 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
48 |
* The name of the class, needed by several sub-processes. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
49 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
50 |
static const char *GetClassName() { return "AITile"; } |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
51 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
52 |
/** |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
53 |
* Check if this tile is buildable (e.g.: no things on it that needs removing). |
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 |
* @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
|
56 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
57 |
* @return true if it is buildable, false if not. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
58 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
59 |
static bool IsBuildable(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
60 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
61 |
/** |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
62 |
* Check if this tile is buildable in a rectangle around a tile, with the entry in the list as top-left. |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
63 |
* @note Road and rail are considered buildable. |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
64 |
* @param tile the tile to check on. |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
65 |
* @param width the width of the rectangle. |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
66 |
* @param height the height of the rectangle. |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
67 |
* @pre AIMap::IsValidTile(tile). |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
68 |
* @return true if it is buildable, false if not. |
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 |
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
|
71 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
72 |
/** |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
73 |
* Check if a tile is water. |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
74 |
* @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
|
75 |
* @pre AIMap::IsValidTile(tile). |
9698
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
76 |
* @return true if it is water, false if not. |
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 |
static bool IsWater(TileIndex tile); |
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
79 |
|
1d50fe99b7e9
(svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents:
9658
diff
changeset
|
80 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
81 |
* Get the slope of a tile. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
82 |
* @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
|
83 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
84 |
* @return 0 means flat, others indicate internal state of slope. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
85 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
86 |
static int32 GetSlope(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
87 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
88 |
/** |
9700
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
89 |
* Get the height of the tile. |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
90 |
* @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
|
91 |
* @pre AIMap::IsValidTile(tile). |
9700
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
92 |
* @return the height of the tile, ranging from 0 to 15. |
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 |
static int32 GetHeight(TileIndex tile); |
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
95 |
|
e442ce398e83
(svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents:
9698
diff
changeset
|
96 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
97 |
* Check how much cargo this tile accepts. |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
98 |
* 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
|
99 |
* cargo. |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
100 |
* @param tile the tile to check on. |
9619
6e81cec30a2b
(svn r9788) [NoAI] -Fix r9786: forgot to doxygen comment 1 param
truelight
parents:
9617
diff
changeset
|
101 |
* @param cargo_type the cargo to check the acceptance of. |
9658
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
102 |
* @param width the width of the station. |
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
103 |
* @param height the height of the station. |
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
104 |
* @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
|
105 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
106 |
* @return value below 8 means no acceptance; the more the better. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
107 |
*/ |
9658
e7675771bca4
(svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents:
9619
diff
changeset
|
108 |
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
|
109 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
110 |
/** |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
111 |
* Checks how many tiles in the radius produces this cargo. |
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 tiles that produce |
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
113 |
* this cargo. |
9729
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
114 |
* @param tile the tile to check on. |
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
115 |
* @param cargo_type the cargo to check the production of. |
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
116 |
* @param width the width of the station. |
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
117 |
* @param height the height of the station. |
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
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). |
9771
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
120 |
* @return the tiles that produce this cargo within radius of the tile. |
769496a7b02e
(svn r12264) [NoAI] -Add: added AITileList_vCargoProduction (yorick)
truebrain
parents:
9737
diff
changeset
|
121 |
* @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
|
122 |
*/ |
9735
9f06148355f4
(svn r12214) [NoAI] -Fix: 'rad' -> 'radius' for consistancy reasons
truebrain
parents:
9729
diff
changeset
|
123 |
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
|
124 |
|
c264c78a3567
(svn r12152) [NoAI] -Add [FS#1772]: add AITile.GetCargoProduction() function (Morloth)
glx
parents:
9708
diff
changeset
|
125 |
/** |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
126 |
* 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
|
127 |
* @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
|
128 |
* @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
|
129 |
* @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
|
130 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
131 |
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
|
132 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
133 |
/** |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
134 |
* 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
|
135 |
* @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
|
136 |
* @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
|
137 |
* @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
|
138 |
*/ |
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
139 |
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
|
140 |
|
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9801
diff
changeset
|
141 |
/** |
9708
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
142 |
* 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
|
143 |
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
144 |
* @param tile the tile to raise. |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
145 |
* @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
|
146 |
* @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
|
147 |
* @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
|
148 |
*/ |
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
|
149 |
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
|
150 |
|
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
151 |
/** |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
152 |
* 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
|
153 |
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
154 |
* @param tile the tile to lower. |
a63a756fd080
(svn r11274) [NoAI] -Add: added LowerTile and RaiseTile to 'terraform' the map a bit (dynaxo)
truelight
parents:
9700
diff
changeset
|
155 |
* @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
|
156 |
* @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
|
157 |
* @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
|
158 |
*/ |
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
|
159 |
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
|
160 |
|
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
161 |
}; |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
162 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
diff
changeset
|
163 |
#endif /* AI_TILE_HPP */ |