OpenTTD Source: src/map_type.h Source File

OpenTTD Source 1.11.0-RC1

map_type.h
Go to the documentation of this file.
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 */
7
10 #ifndef MAP_TYPE_H
11 #define MAP_TYPE_H
12
17 struct Tile {
18 byte type;
19 byte height;
20 uint16 m2;
21 byte m1;
22 byte m3;
23 byte m4;
24 byte m5;
25 };
26
27 static_assert(sizeof(Tile) == 8);
28
33 struct TileExtended {
34 byte m6;
35 byte m7;
36 uint16 m8;
37 };
38
49 typedef int32 TileIndexDiff;
50
57 struct TileIndexDiffC {
58 int16 x;
59 int16 y;
60 };
61
63 static const uint MIN_MAP_SIZE_BITS = 6;
64 static const uint MAX_MAP_SIZE_BITS = 12;
65 static const uint MIN_MAP_SIZE = 1 << MIN_MAP_SIZE_BITS;
66 static const uint MAX_MAP_SIZE = 1 << MAX_MAP_SIZE_BITS;
67
78 #define STRAIGHT_TRACK_LENGTH 7071/10000
79
81 enum LevelMode {
82 LM_LEVEL,
83 LM_LOWER,
84 LM_RAISE,
85 };
86
87 #endif /* MAP_TYPE_H */
MIN_MAP_SIZE
static const uint MIN_MAP_SIZE
Minimal map size = 64.
Definition: map_type.h:65
MIN_MAP_SIZE_BITS
static const uint MIN_MAP_SIZE_BITS
Minimal and maximal map width and height.
Definition: map_type.h:63
Tile::m2
uint16 m2
Primarily used for indices to towns, industries and stations.
Definition: map_type.h:20
Tile::m1
byte m1
Primarily used for ownership information.
Definition: map_type.h:21
LM_LEVEL
@ LM_LEVEL
Level the land.
Definition: map_type.h:82
LevelMode
LevelMode
Argument for CmdLevelLand describing what to do.
Definition: map_type.h:81
TileIndexDiffC::y
int16 y
The y value of the coordinate.
Definition: map_type.h:59
TileExtended::m6
byte m6
General purpose.
Definition: map_type.h:34
Tile
Data that is stored per tile.
Definition: map_type.h:17
LM_RAISE
@ LM_RAISE
Raise the land.
Definition: map_type.h:84
TileIndexDiffC
A pair-construct of a TileIndexDiff.
Definition: map_type.h:57
Tile::m5
byte m5
General purpose.
Definition: map_type.h:24
TileIndexDiff
int32 TileIndexDiff
An offset value between to tiles.
Definition: map_type.h:49
MAX_MAP_SIZE_BITS
static const uint MAX_MAP_SIZE_BITS
Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS.
Definition: map_type.h:64
TileExtended
Data that is stored per tile.
Definition: map_type.h:33
TileExtended::m7
byte m7
Primarily used for newgrf support.
Definition: map_type.h:35
MAX_MAP_SIZE
static const uint MAX_MAP_SIZE
Maximal map size = 4096.
Definition: map_type.h:66
Tile::m3
byte m3
General purpose.
Definition: map_type.h:22
TileExtended::m8
uint16 m8
General purpose.
Definition: map_type.h:36
Tile::height
byte height
The height of the northern corner.
Definition: map_type.h:19
Tile::type
byte type
The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
Definition: map_type.h:18
LM_LOWER
@ LM_LOWER
Lower the land.
Definition: map_type.h:83
Tile::m4
byte m4
General purpose.
Definition: map_type.h:23
TileIndexDiffC::x
int16 x
The x value of the coordinate.
Definition: map_type.h:58