30
30
/** Tile can't be lowered any lower */
31
31
ERR_TILE_TOO_LOW, // [STR_1003_ALREADY_AT_SEA_LEVEL]
35
* Enumeration for the slope-type (from slopes.h).
33
/** The area was already flat */
34
ERR_AREA_ALREADY_FLAT, // [STR_ALREADY_LEVELLED]
36
/** There is a tunnel underneed */
37
ERR_EXCAVATION_WOULD_DAMAGE, // [STR_1002_EXCAVATION_WOULD_DAMAGE]
41
* Enumeration for corners of tiles.
44
CORNER_W = 0, //!< West corner
45
CORNER_S = 1, //!< South corner
46
CORNER_E = 2, //!< East corner
47
CORNER_N = 3, //!< North corner
49
CORNER_INVALID = 0xFF,
53
* Enumeration for the slope-type.
37
55
* This enumeration use the chars N, E, S, W corresponding the
38
56
* direction North, East, South and West. The top corner of a tile
42
60
/* Values are important, as they represent the internal state of the game. */
43
61
SLOPE_FLAT = 0x00, //!< A flat tile
44
SLOPE_W = 0x01, //!< The west corner of the tile is raised
45
SLOPE_S = 0x02, //!< The south corner of the tile is raised
46
SLOPE_E = 0x04, //!< The east corner of the tile is raised
47
SLOPE_N = 0x08, //!< The north corner of the tile is raised
48
SLOPE_STEEP = 0x10, //!< Indicates the slope is steep
62
SLOPE_W = 1 << CORNER_W, //!< The west corner of the tile is raised
63
SLOPE_S = 1 << CORNER_S, //!< The south corner of the tile is raised
64
SLOPE_E = 1 << CORNER_E, //!< The east corner of the tile is raised
65
SLOPE_N = 1 << CORNER_N, //!< The north corner of the tile is raised
66
SLOPE_STEEP = 0x10, //!< Indicates the slope is steep (The corner opposite of the not-raised corner is raised two times)
49
67
SLOPE_NW = SLOPE_N | SLOPE_W, //!< North and west corner are raised
50
68
SLOPE_SW = SLOPE_S | SLOPE_W, //!< South and west corner are raised
51
69
SLOPE_SE = SLOPE_S | SLOPE_E, //!< South and east corner are raised
52
70
SLOPE_NE = SLOPE_N | SLOPE_E, //!< North and east corner are raised
53
71
SLOPE_EW = SLOPE_E | SLOPE_W, //!< East and west corner are raised
54
72
SLOPE_NS = SLOPE_N | SLOPE_S, //!< North and south corner are raised
55
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, //!< All corner are raised, similar to SLOPE_FLAT
73
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, //!< Bit mask containing all 'simple' slopes. Does not appear as a slope.
56
74
SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, //!< North, west and south corner are raised
57
75
SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, //!< West, south and east corner are raised
58
76
SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, //!< South, east and north corner are raised
62
80
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, //!< A steep slope falling to west (from east)
63
81
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, //!< A steep slope falling to south (from north)
65
SLOPE_INVALID = 0xFF, //!< An invalid slope
83
SLOPE_INVALID = 0xFFFF, //!< An invalid slope
131
149
* Check if a tile has a steep slope.
150
* Steep slopes are slopes with a height difference of 2 across one diagonal of the tile.
132
151
* @param slope The slope to check on.
133
152
* @pre slope != SLOPE_INVALID.
134
153
* @return True if the slope is a steep slope.
139
158
* Check if a tile has a halftile slope.
159
* Halftile slopes appear on top of halftile foundations. E.g. the slope you get when building a horizontal railtrack on the top of a SLOPE_N or SLOPE_STEEP_N.
140
160
* @param slope The slope to check on.
141
161
* @pre slope != SLOPE_INVALID.
142
162
* @return True if the slope is a halftile slope.
163
* @note Currently there is no API function that would return or accept a halftile slope.
144
165
static bool IsHalftileSlope(Slope slope);
195
216
* Get the slope of a tile.
217
* This is the slope of the bare tile. A possible foundation on the tile does not influence this slope.
196
218
* @param tile The tile to check on.
197
219
* @pre AIMap::IsValidTile(tile).
198
* @return 0 means flat, others indicate internal state of slope.
220
* @return Bit mask encoding the slope. See #Slope for a description of the returned values.
200
222
static Slope GetSlope(TileIndex tile);
211
233
static Slope GetComplementSlope(Slope slope);
214
* Get the height of the tile.
236
* Get the height of the north corner of a tile.
237
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
238
* @deprecated This function is deprecated and might be removed in future versions of the API. Use GetMinHeight(), GetMaxHeight() or GetCornerHeight() instead.
215
239
* @param tile The tile to check on.
216
240
* @pre AIMap::IsValidTile(tile).
217
* @return The height of the tile, ranging from 0 to 15.
241
* @return The height of the north corner of the tile, ranging from 0 to 15.
219
243
static int32 GetHeight(TileIndex tile);
246
* Get the minimal height on a tile.
247
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
248
* @param tile The tile to check on.
249
* @pre AIMap::IsValidTile(tile).
250
* @return The height of the lowest corner of the tile, ranging from 0 to 15.
252
static int32 GetMinHeight(TileIndex tile);
255
* Get the maximal height on a tile.
256
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
257
* @param tile The tile to check on.
258
* @pre AIMap::IsValidTile(tile).
259
* @return The height of the highest corner of the tile, ranging from 0 to 15.
261
static int32 GetMaxHeight(TileIndex tile);
264
* Get the height of a certain corner of a tile.
265
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
266
* @param tile The tile to check on.
267
* @param corner The corner to query.
268
* @pre AIMap::IsValidTile(tile).
269
* @return The height of the lowest corner of the tile, ranging from 0 to 15.
271
static int32 GetCornerHeight(TileIndex tile, Corner corner);
222
274
* Get the owner of the tile.
223
275
* @param tile The tile to get the owner from.
224
276
* @pre AIMap::IsValidTile(tile).
251
303
* @param height The height of the station.
252
304
* @param radius The radius of the station.
253
305
* @pre AIMap::IsValidTile(tile).
254
309
* @return Value below 8 means no acceptance; the more the better.
256
static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
311
static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius);
259
314
* Checks how many tiles in the radius produces this cargo.
265
320
* @param height The height of the station.
266
321
* @param radius The radius of the station.
267
322
* @pre AIMap::IsValidTile(tile).
268
326
* @return The tiles that produce this cargo within radius of the tile.
269
327
* @note Town(houses) are not included in the value.
271
static int32 GetCargoProduction(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
329
static int32 GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius);
274
332
* Get the manhattan distance from the tile to the tile.
290
348
* Raise the given corners of the tile. The corners can be combined,
291
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
349
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will raise the west and the north corner.
350
* @note The corners will be modified in the order west (first), south, east, north (last).
351
* Changing one corner might cause another corner to be changed too. So modifiing
352
* multiple corners may result in changing some corners by multiple steps.
292
353
* @param tile The tile to raise.
293
354
* @param slope Corners to raise (SLOPE_xxx).
294
355
* @pre tile < AIMap::GetMapSize().
303
364
* Lower the given corners of the tile. The corners can be combined,
304
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
365
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will lower the west and the north corner.
366
* @note The corners will be modified in the order west (first), south, east, north (last).
367
* Changing one corner might cause another corner to be changed too. So modifiing
368
* multiple corners may result in changing some corners by multiple steps.
305
369
* @param tile The tile to lower.
306
370
* @param slope Corners to lower (SLOPE_xxx).
307
371
* @pre tile < AIMap::GetMapSize().