2009-08-21 20:21:05 +00:00
/*
* This file is part of OpenTTD .
* 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.
* 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 .
* 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/>.
*/
2007-12-19 23:26:02 +00:00
/** @file tile_type.h Types related to tiles. */
# ifndef TILE_TYPE_H
# define TILE_TYPE_H
2015-02-14 12:53:07 +00:00
static const uint TILE_SIZE = 16 ; ///< Tile size in world coordinates.
static const uint TILE_UNIT_MASK = TILE_SIZE - 1 ; ///< For masking in/out the inner-tile world coordinate units.
static const uint TILE_PIXELS = 32 ; ///< Pixel distance between tile columns/rows in #ZOOM_LVL_BASE.
static const uint TILE_HEIGHT = 8 ; ///< Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
static const uint MAX_BUILDING_PIXELS = 200 ; ///< Maximum height of a building in pixels in #ZOOM_LVL_BASE. (Also applies to "bridge buildings" on the bridge floor.)
2018-03-11 13:25:26 +00:00
static const int MAX_VEHICLE_PIXEL_X = 192 ; ///< Maximum width of a vehicle in pixels in #ZOOM_LVL_BASE.
static const int MAX_VEHICLE_PIXEL_Y = 96 ; ///< Maximum height of a vehicle in pixels in #ZOOM_LVL_BASE.
2007-12-19 23:26:02 +00:00
2014-10-13 14:30:59 +00:00
static const uint MAX_TILE_HEIGHT = 255 ; ///< Maximum allowed tile height
2007-12-25 23:42:52 +00:00
2021-03-24 19:51:41 +00:00
static const uint MIN_HEIGHTMAP_HEIGHT = 1 ; ///< Lowest possible peak value for heightmap creation
2021-03-24 22:25:51 +00:00
static const uint MIN_CUSTOM_TERRAIN_TYPE = 1 ; ///< Lowest possible peak value for world generation
2021-03-24 19:51:41 +00:00
2021-03-24 08:42:54 +00:00
static const uint MIN_MAP_HEIGHT_LIMIT = 15 ; ///< Lower bound of maximum allowed heightlevel (in the construction settings)
static const uint MAX_MAP_HEIGHT_LIMIT = MAX_TILE_HEIGHT ; ///< Upper bound of maximum allowed heightlevel (in the construction settings)
2014-09-21 11:27:34 +00:00
2010-05-13 11:19:30 +00:00
static const uint MIN_SNOWLINE_HEIGHT = 2 ; ///< Minimum snowline height
2021-01-08 11:02:38 +00:00
static const uint DEF_SNOWLINE_HEIGHT = 10 ; ///< Default snowline height
2010-05-13 11:19:30 +00:00
static const uint MAX_SNOWLINE_HEIGHT = ( MAX_TILE_HEIGHT - 2 ) ; ///< Maximum allowed snowline height
2007-12-19 23:26:02 +00:00
2021-03-20 18:39:33 +00:00
static const uint MIN_RAINFOREST_HEIGHT = 1 ; ///< Minimum rainforest height
static const uint DEF_RAINFOREST_HEIGHT = 8 ; ///< Default rainforest height
static const uint MAX_RAINFOREST_HEIGHT = 255 ; ///< Maximum rainforest height
2021-03-24 13:48:12 +00:00
static const uint DEF_SNOW_COVERAGE = 40 ; ///< Default snow coverage.
2021-03-24 15:38:36 +00:00
static const uint DEF_DESERT_COVERAGE = 50 ; ///< Default desert coverage.
2021-03-24 13:48:12 +00:00
2007-12-19 23:26:02 +00:00
/**
2008-10-13 03:26:48 +00:00
* The different types of tiles .
2007-12-19 23:26:02 +00:00
*
* Each tile belongs to one type , according whatever is build on it .
*
* @ note A railway with a crossing street is marked as MP_ROAD .
*/
enum TileType {
MP_CLEAR , ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
MP_RAILWAY , ///< A railway
MP_ROAD , ///< A tile with road (or tram tracks)
MP_HOUSE , ///< A house by a town
MP_TREES , ///< Tile got trees
MP_STATION , ///< A tile of a station
MP_WATER , ///< Water tile
MP_VOID , ///< Invisible tiles at the SW and SE border
MP_INDUSTRY , ///< Part of an industry
MP_TUNNELBRIDGE , ///< Tunnel entry/exit and bridge heads
2010-08-08 10:59:30 +00:00
MP_OBJECT , ///< Contains objects such as transmitters and owned land
2007-12-19 23:26:02 +00:00
} ;
/**
* Additional infos of a tile on a tropic game .
*
2008-01-30 17:22:06 +00:00
* The tropiczone is not modified during gameplay . It mainly affects tree growth . ( desert tiles are visible though )
*
* In randomly generated maps :
* TROPICZONE_DESERT : Generated everywhere , if there is neither water nor mountains ( TileHeight > = 4 ) in a certain distance from the tile .
2013-01-08 22:46:42 +00:00
* TROPICZONE_RAINFOREST : Generated everywhere , if there is no desert in a certain distance from the tile .
2008-01-30 17:22:06 +00:00
* TROPICZONE_NORMAL : Everywhere else , i . e . between desert and rainforest and on sea ( if you clear the water ) .
*
* In scenarios :
* TROPICZONE_NORMAL : Default value .
* TROPICZONE_DESERT : Placed manually .
* TROPICZONE_RAINFOREST : Placed if you plant certain rainforest - trees .
2007-12-19 23:26:02 +00:00
*/
enum TropicZone {
2008-01-30 17:22:06 +00:00
TROPICZONE_NORMAL = 0 , ///< Normal tropiczone
2007-12-19 23:26:02 +00:00
TROPICZONE_DESERT = 1 , ///< Tile is desert
TROPICZONE_RAINFOREST = 2 , ///< Rainforest tile
} ;
/**
* The index / ID of a Tile .
*/
2024-01-07 16:41:53 +00:00
typedef uint32_t TileIndex ;
2007-12-19 23:26:02 +00:00
2007-12-25 23:42:52 +00:00
/**
* The very nice invalid tile marker
*/
2024-01-07 15:00:16 +00:00
inline constexpr TileIndex INVALID_TILE = ( TileIndex ) - 1 ;
2007-12-25 23:42:52 +00:00
2007-12-19 23:26:02 +00:00
# endif /* TILE_TYPE_H */