6 #define AI_TILELIST_VALUATOR_HPP |
6 #define AI_TILELIST_VALUATOR_HPP |
7 |
7 |
8 #include "ai_abstractlist.hpp" |
8 #include "ai_abstractlist.hpp" |
9 |
9 |
10 /** |
10 /** |
11 * Check if tiles are buildable for entries in an AITileList instance. |
11 * Check if tiles are buildable for entries in an AITileList_v instance. |
12 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable) |
12 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable) |
13 * @note the input items are of the type TileIndex |
13 * @note the input items are of the type TileIndex |
14 */ |
14 */ |
15 class AITileListBuildable : public AIAbstractList::Valuator { |
15 class AITileList_vBuildable : public AIAbstractList::Valuator { |
16 public: |
16 public: |
17 /** |
17 /** |
18 * The name of the class, needed by several sub-processes. |
18 * The name of the class, needed by several sub-processes. |
19 */ |
19 */ |
20 static const char *GetClassName() { return "AITileListBuildable"; } |
20 static const char *GetClassName() { return "AITileList_vBuildable"; } |
21 |
21 |
22 private: |
22 private: |
23 int32 Valuate(int32 tile) const; |
23 int32 Valuate(int32 tile) const; |
24 }; |
24 }; |
25 |
25 |
26 /** |
26 /** |
27 * Check if tiles are water-tiles for entries in an AITileList instance. |
27 * Check if tiles are water-tiles for entries in an AITileList_v instance. |
28 * @note resulting items are of the type bool (0 = not water-tile, 1 = water-tile) |
28 * @note resulting items are of the type bool (0 = not water-tile, 1 = water-tile) |
29 * @note the input items are of the type TileIndex |
29 * @note the input items are of the type TileIndex |
30 */ |
30 */ |
31 class AITileListWater : public AIAbstractList::Valuator { |
31 class AITileList_vWater : public AIAbstractList::Valuator { |
32 public: |
32 public: |
33 /** |
33 /** |
34 * The name of the class, needed by several sub-processes. |
34 * The name of the class, needed by several sub-processes. |
35 */ |
35 */ |
36 static const char *GetClassName() { return "AITileListWater"; } |
36 static const char *GetClassName() { return "AITileList_vWater"; } |
37 |
37 |
38 private: |
38 private: |
39 int32 Valuate(int32 tile) const; |
39 int32 Valuate(int32 tile) const; |
40 }; |
40 }; |
41 |
41 |
42 /** |
42 /** |
43 * Check if tiles are buildable in a rectangle around entries in an AITileList instance, with the entry in the list as top-left. |
43 * Check if tiles are buildable in a rectangle around entries in an AITileList_v instance, with the entry in the list as top-left. |
44 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable) |
44 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable) |
45 * @note the input items are of the type TileIndex |
45 * @note the input items are of the type TileIndex |
46 */ |
46 */ |
47 class AITileListBuildableRectangle : public AIAbstractList::Valuator { |
47 class AITileList_vBuildableRectangle : public AIAbstractList::Valuator { |
48 public: |
48 public: |
49 /** |
49 /** |
50 * The name of the class, needed by several sub-processes. |
50 * The name of the class, needed by several sub-processes. |
51 */ |
51 */ |
52 static const char *GetClassName() { return "AITileListBuildableRectangle"; } |
52 static const char *GetClassName() { return "AITileList_vBuildableRectangle"; } |
53 |
53 |
54 /** |
54 /** |
55 * Custom constructor, we want a width and height as parameter. |
55 * Custom constructor, we want a width and height as parameter. |
56 */ |
56 */ |
57 AITileListBuildableRectangle(uint width, uint height) { this->width = width; this->height = height; } |
57 AITileList_vBuildableRectangle(uint width, uint height) { this->width = width; this->height = height; } |
58 |
58 |
59 private: |
59 private: |
60 uint width, height; |
60 uint width, height; |
61 |
61 |
62 int32 Valuate(int32 tile) const; |
62 int32 Valuate(int32 tile) const; |
63 }; |
63 }; |
64 |
64 |
65 /** |
65 /** |
66 * Check how tiles in an AITileList instance are sloped. |
66 * Check how tiles in an AITileList_v instance are sloped. |
67 * @note resulting items are of the type int32 (0 = flat, > 1 = slope) |
67 * @note resulting items are of the type int32 (0 = flat, > 1 = slope) |
68 * @note the input items are of the type TileIndex |
68 * @note the input items are of the type TileIndex |
69 */ |
69 */ |
70 class AITileListSlope : public AIAbstractList::Valuator { |
70 class AITileList_vSlope : public AIAbstractList::Valuator { |
71 public: |
71 public: |
72 /** |
72 /** |
73 * The name of the class, needed by several sub-processes. |
73 * The name of the class, needed by several sub-processes. |
74 */ |
74 */ |
75 static const char *GetClassName() { return "AITileListSlope"; } |
75 static const char *GetClassName() { return "AITileList_vSlope"; } |
76 |
76 |
77 private: |
77 private: |
78 int32 Valuate(int32 tile) const; |
78 int32 Valuate(int32 tile) const; |
79 }; |
79 }; |
80 |
80 |
81 /** |
81 /** |
82 * Check the height of the tiles in an AITileList instance. |
82 * Check the height of the tiles in an AITileList_v instance. |
83 * @note resulting items are of the type int32 (height, ranging from 0 to 15) |
83 * @note resulting items are of the type int32 (height, ranging from 0 to 15) |
84 * @note the input items are of the type TileIndex |
84 * @note the input items are of the type TileIndex |
85 */ |
85 */ |
86 class AITileListHeight : public AIAbstractList::Valuator { |
86 class AITileList_vHeight : public AIAbstractList::Valuator { |
87 public: |
87 public: |
88 /** |
88 /** |
89 * The name of the class, needed by several sub-processes. |
89 * The name of the class, needed by several sub-processes. |
90 */ |
90 */ |
91 static const char *GetClassName() { return "AITileListHeight"; } |
91 static const char *GetClassName() { return "AITileList_vHeight"; } |
92 |
92 |
93 private: |
93 private: |
94 int32 Valuate(int32 tile) const; |
94 int32 Valuate(int32 tile) const; |
95 }; |
95 }; |
96 |
96 |
97 /** |
97 /** |
98 * Count for each entry in AITileList the amount of neighbours that contain road. |
98 * Count for each entry in AITileList_v the amount of neighbours that contain road. |
99 * This is a value between 0 and 4, as it only check horizontal and vertical. |
99 * This is a value between 0 and 4, as it only check horizontal and vertical. |
100 * @note resulting items are of the type int32 (the amount of neighbour road tiles, value between 0 and 4) |
100 * @note resulting items are of the type int32 (the amount of neighbour road tiles, value between 0 and 4) |
101 * @note the input items are of the type TileIndex |
101 * @note the input items are of the type TileIndex |
102 */ |
102 */ |
103 class AITileListNeighbourRoadCount : public AIAbstractList::Valuator { |
103 class AITileList_vNeighbourRoadCount : public AIAbstractList::Valuator { |
104 public: |
104 public: |
105 /** |
105 /** |
106 * The name of the class, needed by several sub-processes. |
106 * The name of the class, needed by several sub-processes. |
107 */ |
107 */ |
108 static const char *GetClassName() { return "AITileListNeighbourRoad"; } |
108 static const char *GetClassName() { return "AITileList_vNeighbourRoad"; } |
109 |
109 |
110 private: |
110 private: |
111 int32 Valuate(int32 tile) const; |
111 int32 Valuate(int32 tile) const; |
112 }; |
112 }; |
113 |
113 |
114 /** |
114 /** |
115 * Check if the tiles in AITileList have a piece of road on them. |
115 * Check if the tiles in AITileList_v have a piece of road on them. |
116 * @note resulting items are of the type bool (0 = no road, 1 = road) |
116 * @note resulting items are of the type bool (0 = no road, 1 = road) |
117 * @note the input items are of the type TileIndex |
117 * @note the input items are of the type TileIndex |
118 */ |
118 */ |
119 class AITileListRoadTile : public AIAbstractList::Valuator { |
119 class AITileList_vRoadTile : public AIAbstractList::Valuator { |
120 public: |
120 public: |
121 /** |
121 /** |
122 * The name of the class, needed by several sub-processes. |
122 * The name of the class, needed by several sub-processes. |
123 */ |
123 */ |
124 static const char *GetClassName() { return "AITileListRoadTile"; } |
124 static const char *GetClassName() { return "AITileList_vRoadTile"; } |
125 |
125 |
126 private: |
126 private: |
127 int32 Valuate(int32 tile) const; |
127 int32 Valuate(int32 tile) const; |
128 }; |
128 }; |
129 |
129 |
130 /** |
130 /** |
131 * Get the amount of estimated accepted cargo for all tiles in AITileList. |
131 * Get the amount of estimated accepted cargo for all tiles in AITileList_v. |
132 * If this value is >= 8, it means it will accept this cargo. For passengers |
132 * If this value is >= 8, it means it will accept this cargo. For passengers |
133 * and mail it is also a good indicator how much cargo would be brought to |
133 * and mail it is also a good indicator how much cargo would be brought to |
134 * the station. |
134 * the station. |
135 * @post values < 8 means this tile does not accept this cargo. |
135 * @post values < 8 means this tile does not accept this cargo. |
136 * @note resulting items are of the type int32 (indicating acceptance) |
136 * @note resulting items are of the type int32 (indicating acceptance) |
137 * @note the input items are of the type TileIndex |
137 * @note the input items are of the type TileIndex |
138 */ |
138 */ |
139 class AITileListCargoAcceptance : public AIAbstractList::Valuator { |
139 class AITileList_vCargoAcceptance : public AIAbstractList::Valuator { |
140 public: |
140 public: |
141 /** |
141 /** |
142 * The name of the class, needed by several sub-processes. |
142 * The name of the class, needed by several sub-processes. |
143 */ |
143 */ |
144 static const char *GetClassName() { return "AITileListCargoAcceptance"; } |
144 static const char *GetClassName() { return "AITileList_vCargoAcceptance"; } |
145 |
145 |
146 /** |
146 /** |
147 * Custom constructor, we want a cargo-type as parameter. |
147 * Custom constructor, we want a cargo-type as parameter. |
148 */ |
148 */ |
149 AITileListCargoAcceptance(CargoID cargo_type, uint width, uint height, uint radius) { this->cargo_type = cargo_type; this->width = width; this->height = height; this->radius = radius; } |
149 AITileList_vCargoAcceptance(CargoID cargo_type, uint width, uint height, uint radius) { this->cargo_type = cargo_type; this->width = width; this->height = height; this->radius = radius; } |
150 |
150 |
151 private: |
151 private: |
152 CargoID cargo_type; |
152 CargoID cargo_type; |
153 uint width, height, radius; |
153 uint width, height, radius; |
154 |
154 |
155 int32 Valuate(int32 tile) const; |
155 int32 Valuate(int32 tile) const; |
156 }; |
156 }; |
157 |
157 |
158 /** |
158 /** |
159 * Get the manhattan distance to a tile for entries in an AITileList instance. |
159 * Get the manhattan distance to a tile for entries in an AITileList_v instance. |
160 * @note resulting items are of the type distance |
160 * @note resulting items are of the type distance |
161 * @note the input items are of the type TileIndex |
161 * @note the input items are of the type TileIndex |
162 */ |
162 */ |
163 class AITileListDistanceManhattanToTile : public AIAbstractList::Valuator { |
163 class AITileList_vDistanceManhattanToTile : public AIAbstractList::Valuator { |
164 public: |
164 public: |
165 /** |
165 /** |
166 * The name of the class, needed by several sub-processes. |
166 * The name of the class, needed by several sub-processes. |
167 */ |
167 */ |
168 static const char *GetClassName() { return "AITileListDistanceManhattanToTile"; } |
168 static const char *GetClassName() { return "AITileList_vDistanceManhattanToTile"; } |
169 |
169 |
170 /** |
170 /** |
171 * Custom constructor, we want a tile as parameter. |
171 * Custom constructor, we want a tile as parameter. |
172 */ |
172 */ |
173 AITileListDistanceManhattanToTile(TileIndex tile) { this->tile = tile; } |
173 AITileList_vDistanceManhattanToTile(TileIndex tile) { this->tile = tile; } |
174 |
174 |
175 private: |
175 private: |
176 TileIndex tile; |
176 TileIndex tile; |
177 |
177 |
178 int32 Valuate(int32 station) const; |
178 int32 Valuate(int32 station) const; |
179 }; |
179 }; |
180 |
180 |
181 /** |
181 /** |
182 * Get the sqsuare distance to a tile for entries in an AITileList instance. |
182 * Get the sqsuare distance to a tile for entries in an AITileList_v instance. |
183 * @note resulting items are of the type distance |
183 * @note resulting items are of the type distance |
184 * @note the input items are of the type TileIndex |
184 * @note the input items are of the type TileIndex |
185 */ |
185 */ |
186 class AITileListDistanceSquareToTile : public AIAbstractList::Valuator { |
186 class AITileList_vDistanceSquareToTile : public AIAbstractList::Valuator { |
187 public: |
187 public: |
188 /** |
188 /** |
189 * The name of the class, needed by several sub-processes. |
189 * The name of the class, needed by several sub-processes. |
190 */ |
190 */ |
191 static const char *GetClassName() { return "AITileListDistanceSquareToTile"; } |
191 static const char *GetClassName() { return "AITileList_vDistanceSquareToTile"; } |
192 |
192 |
193 /** |
193 /** |
194 * Custom constructor, we want a tile as parameter. |
194 * Custom constructor, we want a tile as parameter. |
195 */ |
195 */ |
196 AITileListDistanceSquareToTile(TileIndex tile) { this->tile = tile; } |
196 AITileList_vDistanceSquareToTile(TileIndex tile) { this->tile = tile; } |
197 |
197 |
198 private: |
198 private: |
199 TileIndex tile; |
199 TileIndex tile; |
200 |
200 |
201 int32 Valuate(int32 station) const; |
201 int32 Valuate(int32 station) const; |