OpenTTD Source  20241108-master-g80f628063a
tile_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 TILE_TYPE_H
11 #define TILE_TYPE_H
12 
14 
15 static const uint TILE_SIZE = 16;
16 static const uint TILE_UNIT_MASK = TILE_SIZE - 1;
17 static const uint TILE_PIXELS = 32;
18 static const uint TILE_HEIGHT = 8;
19 
20 static const uint MAX_BUILDING_PIXELS = 200;
21 static const int MAX_VEHICLE_PIXEL_X = 192;
22 static const int MAX_VEHICLE_PIXEL_Y = 96;
23 
24 static const uint MAX_TILE_HEIGHT = 255;
25 
26 static const uint MIN_HEIGHTMAP_HEIGHT = 1;
27 static const uint MIN_CUSTOM_TERRAIN_TYPE = 1;
28 
29 static const uint MIN_MAP_HEIGHT_LIMIT = 15;
31 
32 static const uint MIN_SNOWLINE_HEIGHT = 2;
33 static const uint DEF_SNOWLINE_HEIGHT = 10;
34 static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2);
35 
36 static const uint DEF_SNOW_COVERAGE = 40;
37 static const uint DEF_DESERT_COVERAGE = 50;
38 
39 
47 enum TileType {
59 };
60 
76 enum TropicZone {
80 };
81 
88 
89 /* Make sure the size is as expected. */
90 static_assert(sizeof(TileIndex) == 4);
91 
95 inline constexpr TileIndex INVALID_TILE = TileIndex{ (uint32_t)-1 };
96 
97 #endif /* TILE_TYPE_H */
Type (helpers) for making a strong typedef that is a distinct type.
Mix-in which makes the new Typedef compatible with another type (which is not the base type).
TropicZone
Additional infos of a tile on a tropic game.
Definition: tile_type.h:76
@ TROPICZONE_RAINFOREST
Rainforest tile.
Definition: tile_type.h:79
@ TROPICZONE_DESERT
Tile is desert.
Definition: tile_type.h:78
@ TROPICZONE_NORMAL
Normal tropiczone.
Definition: tile_type.h:77
static const uint TILE_PIXELS
Pixel distance between tile columns/rows in #ZOOM_BASE.
Definition: tile_type.h:17
static const uint MIN_MAP_HEIGHT_LIMIT
Lower bound of maximum allowed heightlevel (in the construction settings)
Definition: tile_type.h:29
static const uint MAX_BUILDING_PIXELS
Maximum height of a building in pixels in #ZOOM_BASE. (Also applies to "bridge buildings" on the brid...
Definition: tile_type.h:20
static const int MAX_VEHICLE_PIXEL_Y
Maximum height of a vehicle in pixels in #ZOOM_BASE.
Definition: tile_type.h:22
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_BASE.
Definition: tile_type.h:18
static const uint MIN_SNOWLINE_HEIGHT
Minimum snowline height.
Definition: tile_type.h:32
static const uint MIN_CUSTOM_TERRAIN_TYPE
Lowest possible peak value for world generation.
Definition: tile_type.h:27
static const uint DEF_DESERT_COVERAGE
Default desert coverage.
Definition: tile_type.h:37
static const uint TILE_SIZE
Tile size in world coordinates.
Definition: tile_type.h:15
static const uint MAX_TILE_HEIGHT
Maximum allowed tile height.
Definition: tile_type.h:24
static const uint TILE_UNIT_MASK
For masking in/out the inner-tile world coordinate units.
Definition: tile_type.h:16
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
static const uint MAX_SNOWLINE_HEIGHT
Maximum allowed snowline height.
Definition: tile_type.h:34
static const uint DEF_SNOWLINE_HEIGHT
Default snowline height.
Definition: tile_type.h:33
static const uint MIN_HEIGHTMAP_HEIGHT
Lowest possible peak value for heightmap creation.
Definition: tile_type.h:26
TileType
The different types of tiles.
Definition: tile_type.h:47
@ MP_TREES
Tile got trees.
Definition: tile_type.h:52
@ MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:50
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition: tile_type.h:57
@ MP_CLEAR
A tile without any structures, i.e. grass, rocks, farm fields etc.
Definition: tile_type.h:48
@ MP_HOUSE
A house by a town.
Definition: tile_type.h:51
@ MP_WATER
Water tile.
Definition: tile_type.h:54
@ MP_RAILWAY
A railway.
Definition: tile_type.h:49
@ MP_INDUSTRY
Part of an industry.
Definition: tile_type.h:56
@ MP_VOID
Invisible tiles at the SW and SE border.
Definition: tile_type.h:55
@ MP_OBJECT
Contains objects such as transmitters and owned land.
Definition: tile_type.h:58
static const int MAX_VEHICLE_PIXEL_X
Maximum width of a vehicle in pixels in #ZOOM_BASE.
Definition: tile_type.h:21
static const uint MAX_MAP_HEIGHT_LIMIT
Upper bound of maximum allowed heightlevel (in the construction settings)
Definition: tile_type.h:30
static const uint DEF_SNOW_COVERAGE
Default snow coverage.
Definition: tile_type.h:36