OpenTTD Source  20240915-master-g3784a3d3d6
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. More...
 
 Tile (uint tile)
 Create the tile wrapper for the given tile. More...
 
constexpr debug_inline operator TileIndex () const
 Implicit conversion to the TileIndex.
 
constexpr debug_inline 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) More...
 
debug_inline uint8_t & height ()
 The height of the northern corner. More...
 
debug_inline uint8_t & m1 ()
 Primarily used for ownership information. More...
 
debug_inline uint16_t & m2 ()
 Primarily used for indices to towns, industries and stations. More...
 
debug_inline uint8_t & m3 ()
 General purpose. More...
 
debug_inline uint8_t & m4 ()
 General purpose. More...
 
debug_inline uint8_t & m5 ()
 General purpose. More...
 
debug_inline uint8_t & m6 ()
 General purpose. More...
 
debug_inline uint8_t & m7 ()
 Primarily used for newgrf support. More...
 
debug_inline uint16_t & m8 ()
 General purpose. More...
 

Private Attributes

TileIndex tile
 The tile to access the map data for.
 

Static Private Attributes

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

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.

Referenced by SetTileHeight().

◆ m1()

debug_inline uint8_t& Tile::m1 ( )
inline

Primarily used for ownership information.

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 113 of file map_func.h.

Referenced by GetHouseRandomBits(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetTileOwner(), GetWaterClass(), IsDockingTile(), IsIndustryCompleted(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeVoid(), ResetIndustryConstructionStage(), SetDockingTile(), SetHouseRandomBits(), SetIndustryCompleted(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetTileOwner(), and SetWaterClass().

◆ m2()

debug_inline uint16_t& Tile::m2 ( )
inline

◆ 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.

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

◆ m6()

◆ m7()

debug_inline uint8_t& Tile::m7 ( )
inline

◆ m8()

debug_inline uint16_t& Tile::m8 ( )
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 uint16_t holding the data.

Definition at line 197 of file map_func.h.

Referenced by GetCustomRoadStopSpecIndex(), GetRailType(), IsCustomRoadStopSpecIndex(), IsRoadWaypointOnSnowOrDesert(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadTunnel(), MakeStation(), SetCustomRoadStopSpecIndex(), SetRailType(), and ToggleRoadWaypointOnSnowOrDesert().

◆ 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.

Referenced by ClearSingleBridgeMiddle(), GetBridgeAxis(), GetTropicZone(), IsBridgeAbove(), SetBridgeMiddle(), SetTileType(), and SetTropicZone().

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::IsInitialized().

◆ 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.


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