113 uint x =
TileX(tile);
114 uint y =
TileY(tile);
138 SB(tile.
type(), 4, 4, type);
204 SB(tile.
m1(), 0, 5, owner);
229 SB(tile.
type(), 0, 2, type);
Functions related to bit mathematics.
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 uint8_t & m7()
Primarily used for newgrf support.
debug_inline uint8_t & height()
The height of the northern corner.
debug_inline uint8_t & type()
The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
debug_inline uint8_t & m1()
Primarily used for ownership information.
Owner
Enum for all companies/owners.
Functions related to maps.
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Types related to global configuration settings.
Slope
Enumeration for the slope-type.
bool freeform_edges
allow terraforming the tiles at the map edges
ConstructionSettings construction
construction of things in-game
static uint MaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static debug_inline uint Size()
Get the size of the map.
static debug_inline uint MaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
uint TileHash(uint x, uint y)
Calculate a hash value from a tile position.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
void SetTileType(Tile tile, TileType type)
Set the type of a tile.
int GetTilePixelZ(TileIndex tile)
Get bottom height of the tile.
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
std::tuple< Slope, int > GetTilePixelSlopeOutsideMap(int x, int y)
Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles).
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
uint8_t GetAnimationFrame(Tile t)
Get the current animation frame.
std::tuple< Slope, int > GetTilePixelSlope(TileIndex tile)
Return the slope of a given tile.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
bool IsInnerTile(Tile tile)
Check if a tile is within the map (not a border)
uint TilePixelHeight(Tile tile)
Returns the height of a tile in pixels.
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
bool IsTileFlat(TileIndex tile, int *h=nullptr)
Check if a given tile is flat.
uint TileHash2Bit(uint x, uint y)
Get the last two bits of the TileHash from a tile position.
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
uint TilePixelHeightOutsideMap(int x, int y)
Returns the height of a tile in pixels, also for tiles outside the map (virtual "black" tiles).
int GetTileMaxZ(TileIndex tile)
Get top height of the tile inside the map.
void SetAnimationFrame(Tile t, uint8_t frame)
Set a new animation frame.
void SetTileHeight(Tile tile, uint height)
Sets the height of a tile.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Slope GetTileSlope(TileIndex tile)
Return the slope of a given tile inside the map.
void SetTropicZone(Tile tile, TropicZone type)
Set the tropic zone.
static debug_inline uint TileHeight(Tile tile)
Returns the height of a tile.
uint TileHeightOutsideMap(int x, int y)
Returns the height of a tile, also for tiles outside the map (virtual "black" tiles).
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
TropicZone
Additional infos of a tile on a tropic game.
@ TROPICZONE_NORMAL
Normal tropiczone.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in ZOOM_BASE.
static const uint MAX_TILE_HEIGHT
Maximum allowed tile height.
TileType
The different types of tiles.
@ MP_STATION
A tile of a station.
@ MP_HOUSE
A house by a town.
@ MP_INDUSTRY
Part of an industry.
@ MP_VOID
Invisible tiles at the SW and SE border.
@ MP_OBJECT
Contains objects such as transmitters and owned land.