Move some tile-related types to a new file tile/type.h
[openttd/fttd.git] / src / map_type.h
blobae27a6634c2c81227586729591e7d1382aee8286
1 /* $Id$ */
3 /*
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/>.
8 */
10 /** @file map_type.h Types related to maps. */
12 #ifndef MAP_TYPE_H
13 #define MAP_TYPE_H
15 /**
16 * Data that is stored per tile. Also used TileC for this.
17 * Look at docs/landscape.html for the exact meaning of the members.
19 struct TileH {
20 byte type_height; ///< Zone and height of the northern corner
23 /**
24 * An offset value between to tiles.
26 * This value is used for the difference between
27 * to tiles. It can be added to a tileindex to get
28 * the resulting tileindex of the start tile applied
29 * with this saved difference.
31 * @see TileDiffXY(int, int)
33 typedef int32 TileIndexDiff;
35 /**
36 * A pair-construct of a TileIndexDiff.
38 * This can be used to save the difference between to
39 * tiles as a pair of x and y value.
41 struct TileIndexDiffC {
42 int16 x; ///< The x value of the coordinate
43 int16 y; ///< The y value of the coordinate
46 /** Minimal and maximal map width and height */
47 static const uint MIN_MAP_SIZE_BITS = 6; ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS
48 static const uint MAX_MAP_SIZE_BITS = 11; ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS
49 static const uint MIN_MAP_SIZE = 1 << MIN_MAP_SIZE_BITS; ///< Minimal map size = 64
50 static const uint MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS; ///< Maximal map size = 2048
52 /**
53 * Approximation of the length of a straight track, relative to a diagonal
54 * track (ie the size of a tile side).
56 * #defined instead of const so it can
57 * stay integer. (no runtime float operations) Is this needed?
58 * Watch out! There are _no_ brackets around here, to prevent intermediate
59 * rounding! Be careful when using this!
60 * This value should be sqrt(2)/2 ~ 0.7071
62 #define STRAIGHT_TRACK_LENGTH 7071/10000
64 /** Argument for CmdLevelLand describing what to do. */
65 enum LevelMode {
66 LM_LEVEL, ///< Level the land.
67 LM_LOWER, ///< Lower the land.
68 LM_RAISE, ///< Raise the land.
71 #endif /* MAP_TYPE_H */