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 
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 {
86 };
87 
88 #endif /* MAP_TYPE_H */
int32 TileIndexDiff
An offset value between to tiles.
Definition: map_type.h:50
byte m7
Primarily used for newgrf support.
Definition: map_type.h:37
uint16 m2
Primarily used for indices to towns, industries and stations.
Definition: map_type.h:22
Lower the land.
Definition: map_type.h:84
Level the land.
Definition: map_type.h:83
byte m6
General purpose.
Definition: map_type.h:36
Raise the land.
Definition: map_type.h:85
byte m1
Primarily used for ownership information.
Definition: map_type.h:23
static const uint MIN_MAP_SIZE
Minimal map size = 64.
Definition: map_type.h:66
int16 y
The y value of the coordinate.
Definition: map_type.h:60
int16 x
The x value of the coordinate.
Definition: map_type.h:59
byte m5
General purpose.
Definition: map_type.h:26
Data that is stored per tile.
Definition: map_type.h:19
Data that is stored per tile.
Definition: map_type.h:35
A pair-construct of a TileIndexDiff.
Definition: map_type.h:58
LevelMode
Argument for CmdLevelLand describing what to do.
Definition: map_type.h:82
byte height
The height of the northern corner.
Definition: map_type.h:21
static const uint MAX_MAP_SIZE_BITS
Maximal size of map is equal to 2 ^ MAX_MAP_SIZE_BITS.
Definition: map_type.h:65
static const uint MAX_MAP_SIZE
Maximal map size = 4096.
Definition: map_type.h:67
byte type
The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
Definition: map_type.h:20
byte m3
General purpose.
Definition: map_type.h:24
static const uint MIN_MAP_SIZE_BITS
Minimal and maximal map width and height.
Definition: map_type.h:64
byte m4
General purpose.
Definition: map_type.h:25