OpenTTD Source  20240915-master-g3784a3d3d6
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 */
MP_CLEAR
@ MP_CLEAR
A tile without any structures, i.e. grass, rocks, farm fields etc.
Definition: tile_type.h:48
MP_HOUSE
@ MP_HOUSE
A house by a town.
Definition: tile_type.h:51
TROPICZONE_DESERT
@ TROPICZONE_DESERT
Tile is desert.
Definition: tile_type.h:78
MIN_SNOWLINE_HEIGHT
static const uint MIN_SNOWLINE_HEIGHT
Minimum snowline height.
Definition: tile_type.h:32
MAX_VEHICLE_PIXEL_Y
static const int MAX_VEHICLE_PIXEL_Y
Maximum height of a vehicle in pixels in #ZOOM_BASE.
Definition: tile_type.h:22
TROPICZONE_RAINFOREST
@ TROPICZONE_RAINFOREST
Rainforest tile.
Definition: tile_type.h:79
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
MP_RAILWAY
@ MP_RAILWAY
A railway.
Definition: tile_type.h:49
TILE_SIZE
static const uint TILE_SIZE
Tile size in world coordinates.
Definition: tile_type.h:15
MIN_CUSTOM_TERRAIN_TYPE
static const uint MIN_CUSTOM_TERRAIN_TYPE
Lowest possible peak value for world generation.
Definition: tile_type.h:27
MP_INDUSTRY
@ MP_INDUSTRY
Part of an industry.
Definition: tile_type.h:56
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
DEF_SNOWLINE_HEIGHT
static const uint DEF_SNOWLINE_HEIGHT
Default snowline height.
Definition: tile_type.h:33
MAX_TILE_HEIGHT
static const uint MAX_TILE_HEIGHT
Maximum allowed tile height.
Definition: tile_type.h:24
MAX_VEHICLE_PIXEL_X
static const int MAX_VEHICLE_PIXEL_X
Maximum width of a vehicle in pixels in #ZOOM_BASE.
Definition: tile_type.h:21
MP_ROAD
@ MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:50
strong_typedef_type.hpp
StrongType::Compatible
Mix-in which makes the new Typedef compatible with another type (which is not the base type).
Definition: strong_typedef_type.hpp:119
TILE_UNIT_MASK
static const uint TILE_UNIT_MASK
For masking in/out the inner-tile world coordinate units.
Definition: tile_type.h:16
MAX_MAP_HEIGHT_LIMIT
static const uint MAX_MAP_HEIGHT_LIMIT
Upper bound of maximum allowed heightlevel (in the construction settings)
Definition: tile_type.h:30
MP_OBJECT
@ MP_OBJECT
Contains objects such as transmitters and owned land.
Definition: tile_type.h:58
MP_WATER
@ MP_WATER
Water tile.
Definition: tile_type.h:54
DEF_DESERT_COVERAGE
static const uint DEF_DESERT_COVERAGE
Default desert coverage.
Definition: tile_type.h:37
MAX_BUILDING_PIXELS
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
MP_TUNNELBRIDGE
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition: tile_type.h:57
MP_TREES
@ MP_TREES
Tile got trees.
Definition: tile_type.h:52
MIN_HEIGHTMAP_HEIGHT
static const uint MIN_HEIGHTMAP_HEIGHT
Lowest possible peak value for heightmap creation.
Definition: tile_type.h:26
TropicZone
TropicZone
Additional infos of a tile on a tropic game.
Definition: tile_type.h:76
MIN_MAP_HEIGHT_LIMIT
static const uint MIN_MAP_HEIGHT_LIMIT
Lower bound of maximum allowed heightlevel (in the construction settings)
Definition: tile_type.h:29
MP_VOID
@ MP_VOID
Invisible tiles at the SW and SE border.
Definition: tile_type.h:55
TileType
TileType
The different types of tiles.
Definition: tile_type.h:47
MAX_SNOWLINE_HEIGHT
static const uint MAX_SNOWLINE_HEIGHT
Maximum allowed snowline height.
Definition: tile_type.h:34
MP_STATION
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
TILE_HEIGHT
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_BASE.
Definition: tile_type.h:18
TILE_PIXELS
static const uint TILE_PIXELS
Pixel distance between tile columns/rows in #ZOOM_BASE.
Definition: tile_type.h:17
TROPICZONE_NORMAL
@ TROPICZONE_NORMAL
Normal tropiczone.
Definition: tile_type.h:77
DEF_SNOW_COVERAGE
static const uint DEF_SNOW_COVERAGE
Default snow coverage.
Definition: tile_type.h:36