(svn r27950) -Merge: Documentation updates from 1.7 branch
[openttd.git] / src / map_type.h
blob620885e5daadc44b96b6e36fa07d02afd339e089
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 TileExtended for this.
17 * Look at docs/landscape.html for the exact meaning of the members.
19 struct Tile {
20 byte type; ///< The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
21 byte height; ///< The height of the northern corner.
22 uint16 m2; ///< Primarily used for indices to towns, industries and stations
23 byte m1; ///< Primarily used for ownership information
24 byte m3; ///< General purpose
25 byte m4; ///< General purpose
26 byte m5; ///< General purpose
29 assert_compile(sizeof(Tile) == 8);
31 /**
32 * Data that is stored per tile. Also used Tile for this.
33 * Look at docs/landscape.html for the exact meaning of the members.
35 struct TileExtended {
36 byte m6; ///< General purpose
37 byte m7; ///< Primarily used for newgrf support
40 /**
41 * An offset value between to tiles.
43 * This value is used for the difference between
44 * to tiles. It can be added to a tileindex to get
45 * the resulting tileindex of the start tile applied
46 * with this saved difference.
48 * @see TileDiffXY(int, int)
50 typedef int32 TileIndexDiff;
52 /**
53 * A pair-construct of a TileIndexDiff.
55 * This can be used to save the difference between to
56 * tiles as a pair of x and y value.
58 struct TileIndexDiffC {
59 int16 x; ///< The x value of the coordinate
60 int16 y; ///< The y value of the coordinate
63 /** Minimal and maximal map width and height */
64 static const uint MIN_MAP_SIZE_BITS = 6; ///< Minimal size of map is equal to 2 ^ MIN_MAP_SIZE_BITS
65 static const uint MAX_MAP_SIZE_BITS = 12; ///< Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS
66 static const uint MIN_MAP_SIZE = 1 << MIN_MAP_SIZE_BITS; ///< Minimal map size = 64
67 static const uint MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS; ///< Maximal map size = 4096
69 /**
70 * Approximation of the length of a straight track, relative to a diagonal
71 * track (ie the size of a tile side).
73 * #defined instead of const so it can
74 * stay integer. (no runtime float operations) Is this needed?
75 * Watch out! There are _no_ brackets around here, to prevent intermediate
76 * rounding! Be careful when using this!
77 * This value should be sqrt(2)/2 ~ 0.7071
79 #define STRAIGHT_TRACK_LENGTH 7071/10000
81 /** Argument for CmdLevelLand describing what to do. */
82 enum LevelMode {
83 LM_LEVEL, ///< Level the land.
84 LM_LOWER, ///< Lower the land.
85 LM_RAISE, ///< Raise the land.
88 #endif /* MAP_TYPE_H */