OpenTTD Source 20241224-master-gf74b0cf984
Tile Class Reference

Wrapper class to abstract away the way the tiles are stored. More...

#include <map_func.h>

Data Structures

struct  TileBase
 Data that is stored per tile. More...
 
struct  TileExtended
 Data that is stored per tile. More...
 

Public Member Functions

debug_inline Tile (TileIndex tile)
 Create the tile wrapper for the given tile.
 
 Tile (uint tile)
 Create the tile wrapper for the given tile.
 
debug_inline constexpr operator TileIndex () const
 Implicit conversion to the TileIndex.
 
debug_inline constexpr operator uint () const
 Implicit conversion to the uint for bounds checking.
 
debug_inline uint8_t & type ()
 The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
 
debug_inline uint8_t & height ()
 The height of the northern corner.
 
debug_inline uint8_t & m1 ()
 Primarily used for ownership information.
 
debug_inline uint16_t & m2 ()
 Primarily used for indices to towns, industries and stations.
 
debug_inline uint8_t & m3 ()
 General purpose.
 
debug_inline uint8_t & m4 ()
 General purpose.
 
debug_inline uint8_t & m5 ()
 General purpose.
 
debug_inline uint8_t & m6 ()
 General purpose.
 
debug_inline uint8_t & m7 ()
 Primarily used for newgrf support.
 
debug_inline uint16_t & m8 ()
 General purpose.
 

Private Attributes

TileIndex tile
 The tile to access the map data for.
 

Static Private Attributes

static TileBasebase_tiles = nullptr
 Pointer to the tile-array.
 
static TileExtendedextended_tiles = nullptr
 Pointer to the extended tile-array.
 

Friends

struct Map
 

Detailed Description

Wrapper class to abstract away the way the tiles are stored.

It is intended to be used to access the "map" data of a single tile.

The wrapper is expected to be fully optimized away by the compiler, even with low optimization levels except when completely disabling it.

Definition at line 25 of file map_func.h.

Constructor & Destructor Documentation

◆ Tile() [1/2]

debug_inline Tile::Tile ( TileIndex  tile)
inline

Create the tile wrapper for the given tile.

Parameters
tileThe tile to access the map for.

Definition at line 64 of file map_func.h.

◆ Tile() [2/2]

Tile::Tile ( uint  tile)
inline

Create the tile wrapper for the given tile.

Parameters
tileThe tile to access the map for.

Definition at line 70 of file map_func.h.

Member Function Documentation

◆ height()

debug_inline uint8_t & Tile::height ( )
inline

The height of the northern corner.

Look at docs/landscape.html for the exact meaning of the data.

Parameters
tileThe tile to get the height for.
Returns
reference to the byte holding the height.

Definition at line 101 of file map_func.h.

References base_tiles, Tile::TileBase::height, and tile.

Referenced by MAPHChunkHandler::Load(), MAPHChunkHandler::Save(), SetTileHeight(), and TileHeight().

◆ m1()

debug_inline uint8_t & Tile::m1 ( )
inline

◆ m2()

◆ m3()

◆ m4()

◆ m5()

debug_inline uint8_t & Tile::m5 ( )
inline

General purpose.

Look at docs/landscape.html for the exact meaning of the data.

Parameters
tileThe tile to get the data for.
Returns
reference to the byte holding the data.

Definition at line 161 of file map_func.h.

References base_tiles, Tile::TileBase::m5, and tile.

Referenced by AddClearCounter(), AddClearDensity(), AddTreeCount(), AddTreeGrowth(), FixOwnerOfRailTrack(), GetCleanIndustryGfx(), GetClearCounter(), GetClearDensity(), GetCrossingRoadAxis(), GetDisallowedRoadDirections(), GetHouseAge(), GetHouseBuildingStage(), GetHouseConstructionTick(), GetLockDirection(), GetLockPart(), GetObjectIndex(), GetRailDepotDirection(), GetRailTileType(), GetRawClearGround(), GetRoadBits(), GetRoadDepotDirection(), GetRoadTileType(), GetShipDepotAxis(), GetShipDepotPart(), GetStationGfx(), GetTrackBits(), GetTreeCount(), GetTreeGrowth(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), GetWaterTileType(), HasCrossingReservation(), HasDepotReservation(), HasTunnelBridgeReservation(), IncHouseConstructionTick(), IncrementHouseAge(), IsBridge(), IsCrossingBarred(), IsTunnel(), MAP5ChunkHandler::Load(), MakeBridgeRamp(), MakeHouseTile(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), ResetHouseAge(), MAP5ChunkHandler::Save(), SetClearCounter(), SetClearDensity(), SetClearGroundDensity(), SetCrossingBarred(), SetCrossingReservation(), SetDepotReservation(), SetDisallowedRoadDirections(), SetHasSignals(), SetIndustryGfx(), SetRailDepotExitDirection(), SetRoadBits(), SetRoadDepotExitDirection(), SetStationGfx(), SetTrackBits(), SetTreeGrowth(), SetTunnelBridgeReservation(), and SetWaterTileType().

◆ m6()

◆ m7()

◆ m8()

debug_inline uint16_t & Tile::m8 ( )
inline

◆ operator TileIndex()

debug_inline constexpr Tile::operator TileIndex ( ) const
inlineconstexpr

Implicit conversion to the TileIndex.

Definition at line 75 of file map_func.h.

References tile.

◆ operator uint()

debug_inline constexpr Tile::operator uint ( ) const
inlineconstexpr

Implicit conversion to the uint for bounds checking.

Definition at line 80 of file map_func.h.

References tile.

◆ type()

debug_inline uint8_t & Tile::type ( )
inline

The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)

Look at docs/landscape.html for the exact meaning of the data.

Parameters
tileThe tile to get the data for.
Returns
reference to the byte holding the data.

Definition at line 89 of file map_func.h.

References base_tiles, tile, and Tile::TileBase::type.

Referenced by ClearSingleBridgeMiddle(), GetBridgeAxis(), GetTileType(), GetTropicZone(), IsBridgeAbove(), MAPTChunkHandler::Load(), MAPTChunkHandler::Save(), SetBridgeMiddle(), SetTileType(), and SetTropicZone().

Friends And Related Symbol Documentation

◆ Map

friend struct Map
friend

Definition at line 27 of file map_func.h.

Field Documentation

◆ base_tiles

Tile::TileBase * Tile::base_tiles = nullptr
staticprivate

Pointer to the tile-array.

Base tiles of the map.

Definition at line 54 of file map_func.h.

Referenced by Map::Allocate(), height(), Map::IsInitialized(), m1(), m2(), m3(), m4(), m5(), and type().

◆ extended_tiles

Tile::TileExtended * Tile::extended_tiles = nullptr
staticprivate

Pointer to the extended tile-array.

Extended tiles of the map.

Definition at line 55 of file map_func.h.

Referenced by Map::Allocate(), m6(), m7(), and m8().

◆ tile

TileIndex Tile::tile
private

The tile to access the map data for.

Definition at line 57 of file map_func.h.

Referenced by height(), m1(), m2(), m3(), m4(), m5(), m6(), m7(), m8(), operator TileIndex(), operator uint(), and type().


The documentation for this class was generated from the following files: