OpenTTD

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