equal
deleted
inserted
replaced
5 #include "stdafx.h" |
5 #include "stdafx.h" |
6 #include "openttd.h" |
6 #include "openttd.h" |
7 #include "tile_map.h" |
7 #include "tile_map.h" |
8 #include "core/math_func.hpp" |
8 #include "core/math_func.hpp" |
9 |
9 |
|
10 /** |
|
11 * Return the slope of a given tile |
|
12 * @param tile Tile to compute slope of |
|
13 * @param h If not \c NULL, pointer to storage of z height |
|
14 * @return Slope of the tile, except for the HALFTILE part */ |
10 Slope GetTileSlope(TileIndex tile, uint *h) |
15 Slope GetTileSlope(TileIndex tile, uint *h) |
11 { |
16 { |
12 uint a; |
17 uint a; |
13 uint b; |
18 uint b; |
14 uint c; |
19 uint c; |
40 if (h != NULL) *h = min * TILE_HEIGHT; |
45 if (h != NULL) *h = min * TILE_HEIGHT; |
41 |
46 |
42 return (Slope)r; |
47 return (Slope)r; |
43 } |
48 } |
44 |
49 |
|
50 /** |
|
51 * Get bottom height of the tile |
|
52 * @param tile Tile to compute height of |
|
53 * @return Minimum height of the tile */ |
45 uint GetTileZ(TileIndex tile) |
54 uint GetTileZ(TileIndex tile) |
46 { |
55 { |
47 if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return 0; |
56 if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return 0; |
48 |
57 |
49 uint h = TileHeight(tile); |
58 uint h = TileHeight(tile); |
52 h = min(h, TileHeight(tile + TileDiffXY(1, 1))); |
61 h = min(h, TileHeight(tile + TileDiffXY(1, 1))); |
53 |
62 |
54 return h * TILE_HEIGHT; |
63 return h * TILE_HEIGHT; |
55 } |
64 } |
56 |
65 |
57 |
66 /** |
|
67 * Get top height of the tile |
|
68 * @param tile Tile to compute height of |
|
69 * @return Maximum height of the tile */ |
58 uint GetTileMaxZ(TileIndex t) |
70 uint GetTileMaxZ(TileIndex t) |
59 { |
71 { |
60 if (TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) return 0; |
72 if (TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) return 0; |
61 |
73 |
62 uint h = TileHeight(t); |
74 uint h = TileHeight(t); |