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/>.
8 /** @file map_type.h Types related to maps. */
14 * An offset value between two tiles.
16 * This value is used for the difference between
17 * two tiles. It can be added to a TileIndex to get
18 * the resulting TileIndex of the start tile applied
19 * with this saved difference.
21 * @see TileDiffXY(int, int)
23 typedef int32_t TileIndexDiff
;
26 * A pair-construct of a TileIndexDiff.
28 * This can be used to save the difference between to
29 * tiles as a pair of x and y value.
31 struct TileIndexDiffC
{
32 int16_t x
; ///< The x value of the coordinate
33 int16_t y
; ///< The y value of the coordinate
36 /** Minimal and maximal map width and height */
37 static const uint MIN_MAP_SIZE_BITS
= 6; ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS
38 static const uint MAX_MAP_SIZE_BITS
= 12; ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS
39 static const uint MIN_MAP_SIZE
= 1U << MIN_MAP_SIZE_BITS
; ///< Minimal map size = 64
40 static const uint MAX_MAP_SIZE
= 1U << MAX_MAP_SIZE_BITS
; ///< Maximal map size = 4096
43 * Approximation of the length of a straight track, relative to a diagonal
44 * track (ie the size of a tile side).
46 * \#defined instead of const so it can
47 * stay integer. (no runtime float operations) Is this needed?
48 * Watch out! There are _no_ brackets around here, to prevent intermediate
49 * rounding! Be careful when using this!
50 * This value should be sqrt(2)/2 ~ 0.7071
52 #define STRAIGHT_TRACK_LENGTH 7071/10000
54 /** Argument for CmdLevelLand describing what to do. */
55 enum LevelMode
: byte
{
56 LM_LEVEL
, ///< Level the land.
57 LM_LOWER
, ///< Lower the land.
58 LM_RAISE
, ///< Raise the land.
61 #endif /* MAP_TYPE_H */