130 return GB(t.
m2(), 4, 2);
166 return GB(t.
m5(), 6, 2) + 1;
229 SB(t.
m5(), 0, 3,
static_cast<uint
>(g));
249 t.
m2() = ground << 6 | density << 4 | 0;
251 t.
m4() = 0 << 5 | 0 << 2;
252 t.
m5() = count << 6 | static_cast<uint>(growth);
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Wrapper class to abstract away the way the tiles are stored.
debug_inline uint16_t & m2()
Primarily used for indices to towns, industries and stations.
debug_inline uint8_t & m7()
Primarily used for newgrf support.
debug_inline uint8_t & m4()
General purpose.
debug_inline uint8_t & m6()
General purpose.
debug_inline uint8_t & m3()
General purpose.
debug_inline uint8_t & m5()
General purpose.
@ OWNER_NONE
The tile has no ownership.
Map writing/reading functions for tiles.
void SetTileType(Tile tile, TileType type)
Set the type of a tile.
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
@ MP_TREES
Tile got trees.
static const uint TREE_COUNT_RAINFOREST
number of tree types for the 'rainforest part' of a sub-tropic map.
uint GetTreeCount(Tile t)
Returns the number of trees on a tile.
TreeGrowthStage GetTreeGrowth(Tile t)
Returns the tree growth stage.
static const uint TREE_COUNT_SUB_TROPICAL
number of tree types for the 'sub-tropic part' of a sub-tropic map.
static const uint TREE_COUNT_TOYLAND
number of tree types on a toyland map.
void MakeTree(Tile t, TreeType type, uint count, TreeGrowthStage growth, TreeGround ground, uint density)
Make a tree-tile.
void SetTreeGrowth(Tile t, TreeGrowthStage g)
Sets the tree growth stage of a tile.
TreeGround GetTreeGround(Tile t)
Returns the groundtype for tree tiles.
TreeGrowthStage
Enumeration for tree growth stages.
@ Dying1
First stage of dying.
@ Growing1
First stage of growth.
@ Growing2
Second stage of growth.
@ Dying2
Second stage of dying.
@ Growing3
Third stage of growth.
void AddTreeCount(Tile t, int c)
Add a amount to the tree-count value of a tile with trees.
static const uint TREE_COUNT_SUB_ARCTIC
number of tree types on a sub arctic map.
TreeType GetTreeType(Tile t)
Returns the treetype of a tile.
TreeGround
Enumeration for ground types of tiles with trees.
@ TREE_GROUND_GRASS
normal grass
@ TREE_GROUND_ROUGH_SNOW
A snow tile that is rough underneath.
@ TREE_GROUND_SNOW_DESERT
a desert or snow tile, depend on landscape
@ TREE_GROUND_ROUGH
some rough tile
TreeType
List of tree types along all landscape types.
@ TREE_RAINFOREST
tree on the 'green part' on a sub-tropical map
@ TREE_TOYLAND
tree on a toyland map
@ TREE_SUB_ARCTIC
tree on a sub_arctic landscape
@ TREE_SUB_TROPICAL
tree on a sub-tropical map, non-rainforest, non-desert
@ TREE_TEMPERATE
temperate tree
@ TREE_CACTUS
a cactus for the 'desert part' on a sub-tropical map
@ TREE_INVALID
An invalid tree.
void SetTreeGroundDensity(Tile t, TreeGround g, uint d)
Set the density and ground type of a tile with trees.
void AddTreeGrowth(Tile t, int a)
Add a value to the tree growth stage.
uint GetTreeDensity(Tile t)
Returns the 'density' of a tile with trees.
static const uint TREE_COUNT_TEMPERATE
number of tree types on a temperate map.
Map accessors for water tiles.
void SetWaterClass(Tile t, WaterClass wc)
Set the water class at a tile.
@ WATER_CLASS_INVALID
Used for industry tiles on land (also for oilrig if newgrf says so).