4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file map_type.h Types related to maps. */
16 * Data that is stored per tile. Also used TileExtended for this.
17 * Look at docs/landscape.html for the exact meaning of the members.
20 byte type_height
; ///< The type (bits 4..7) and height of the northern corner
21 byte m1
; ///< Primarily used for ownership information
22 uint16 m2
; ///< Primarily used for indices to towns, industries and stations
23 byte m3
; ///< General purpose
24 byte m4
; ///< General purpose
25 byte m5
; ///< General purpose
26 byte m6
; ///< Primarily used for bridges and rainforest/desert
30 * Data that is stored per tile. Also used Tile for this.
31 * Look at docs/landscape.html for the exact meaning of the members.
34 byte m7
; ///< Primarily used for newgrf support
38 * An offset value between to tiles.
40 * This value is used fro the difference between
41 * to tiles. It can be added to a tileindex to get
42 * the resulting tileindex of the start tile applied
43 * with this saved difference.
45 * @see TileDiffXY(int, int)
47 typedef int32 TileIndexDiff
;
50 * A pair-construct of a TileIndexDiff.
52 * This can be used to save the difference between to
53 * tiles as a pair of x and y value.
55 struct TileIndexDiffC
{
56 int16 x
; ///< The x value of the coordinate
57 int16 y
; ///< The y value of the coordinate
60 /** Minimal and maximal map width and height */
61 static const uint MIN_MAP_SIZE_BITS
= 6; ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS
62 static const uint MAX_MAP_SIZE_BITS
= 11; ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS
63 static const uint MIN_MAP_SIZE
= 1 << MIN_MAP_SIZE_BITS
; ///< Minimal map size = 64
64 static const uint MAX_MAP_SIZE
= 1 << MAX_MAP_SIZE_BITS
; ///< Maximal map size = 2048
67 * Approximation of the length of a straight track, relative to a diagonal
68 * track (ie the size of a tile side).
70 * #defined instead of const so it can
71 * stay integer. (no runtime float operations) Is this needed?
72 * Watch out! There are _no_ brackets around here, to prevent intermediate
73 * rounding! Be careful when using this!
74 * This value should be sqrt(2)/2 ~ 0.7071
76 #define STRAIGHT_TRACK_LENGTH 7071/10000
78 /** Argument for CmdLevelLand describing what to do. */
80 LM_LEVEL
, ///< Level the land.
81 LM_LOWER
, ///< Lower the land.
82 LM_RAISE
, ///< Raise the land.
85 #endif /* MAP_TYPE_H */