Translations update
[openttd/fttd.git] / src / tile / zoneheight.h
blob59b8fa0aea9c2190a76812bb2a4f9ba1e042e6c1
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file tile/zoneheight.h Types related to tile zone and height. */
10 #ifndef TILE_ZONEHEIGHT_H
11 #define TILE_ZONEHEIGHT_H
13 #include "../stdafx.h"
14 #include "../core/bitmath_func.hpp"
16 static const uint MAX_TILE_HEIGHT = 15; ///< Maximum allowed tile height
18 static const uint MIN_SNOWLINE_HEIGHT = 2; ///< Minimum snowline height
19 static const uint DEF_SNOWLINE_HEIGHT = 7; ///< Default snowline height
20 static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed snowline height
22 /**
23 * Tropic zone of a tile (subtropic climate only).
25 * The tropiczone is not modified during gameplay. It mainly affects tree growth (desert tiles are visible though).
27 * In randomly generated maps:
28 * TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile.
29 * TROPICZONE_RAINFOREST: Generated everywhere, if there is no desert in a certain distance from the tile.
30 * TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water).
32 * In scenarios:
33 * TROPICZONE_NORMAL: Default value.
34 * TROPICZONE_DESERT: Placed manually.
35 * TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees.
37 enum TropicZone {
38 TROPICZONE_NORMAL = 0, ///< Normal tropiczone
39 TROPICZONE_DESERT = 1, ///< Tile is desert
40 TROPICZONE_RAINFOREST = 2, ///< Rainforest tile
43 /**
44 * Zone and height of a tile.
45 * The zone goes into the 2 most significant bits; the height goes into
46 * the 4 least significant bits.
48 typedef byte TileZH;
50 /**
51 * Get the height of a tile
53 * This function returns the height of the northern corner of a tile.
55 * @param t The tile whose height to get
56 * @return The height of the tile
58 static inline uint tilezh_get_height(const TileZH *t)
60 return GB(*t, 0, 4);
63 /**
64 * Set the height of a tile
66 * This function sets the height of the northern corner of a tile.
68 * @param t The tile whose height to set
69 * @param height The new height value of the tile
70 * @pre height <= MAX_TILE_HEIGHT
72 static inline void tilezh_set_height(TileZH *t, uint height)
74 assert(height <= MAX_TILE_HEIGHT);
75 SB(*t, 0, 4, height);
78 /**
79 * Get the tropic zone of a tile
80 * @param t The tile whose zone to get
81 * @return The zone type of the tile
83 static inline TropicZone tilezh_get_zone(const TileZH *t)
85 return (TropicZone)GB(*t, 6, 2);
88 /**
89 * Set the tropic zone of a tile
90 * @param t The tile whose zone to set
91 * @param z The new zone type
92 * @pre tile < MapSize()
94 static inline void tilezh_set_zone(TileZH *t, TropicZone z)
96 SB(*t, 6, 2, z);
99 #endif /* TILE_ZONEHEIGHT_H */