OpenTTD Source: Tile Class Reference

OpenTTD Source 14.0-beta1

Data Structures | Public Member Functions | Private Attributes | Static Private Attributes | Friends
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 byte & | type ()
| The type (bits 4..7), bridges (2..3), rainforest/desert (0..1) More...
debug_inline byte & | height ()
| The height of the northern corner. More...
debug_inline byte & | m1 ()
| Primarily used for ownership information. More...
debug_inline uint16_t & | m2 ()
| Primarily used for indices to towns, industries and stations. More...
debug_inline byte & | m3 ()
| General purpose. More...
debug_inline byte & | m4 ()
| General purpose. More...
debug_inline byte & | m5 ()
| General purpose. More...
debug_inline byte & | m6 ()
| General purpose. More...
debug_inline byte & | 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 TileBase * | base_tiles = nullptr
| Pointer to the tile-array. More...
static TileExtended * | extended_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

  tile | The 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

  tile | The tile to access the map for.

Definition at line 70 of file map_func.h.

## Member Function Documentation

## ◆ height()

debug_inline byte& Tile::height | ( |  | ) |
| inline

The height of the northern corner.

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

Parameters

  tile | The 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 byte& Tile::m1 | ( |  | ) |
| inline

Primarily used for ownership information.

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

Parameters

  tile | The 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(), 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

Primarily used for indices to towns, industries and stations.

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

Parameters

  tile | The tile to get the data for.

Returns
  reference to the uint16_t holding the data.

Definition at line 125 of file map_func.h.

Referenced by GetDepotIndex(), GetIndustryIndex(), GetIndustryIndexOfField(), GetObjectIndex(), GetRailReservationTrackBits(), GetStationIndex(), GetTownIndex(), GetTreeDensity(), GetTreeGround(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), SetIndustryIndexOfField(), SetTownIndex(), SetTrackReservation(), and SetTreeGroundDensity().

## ◆ m3()

debug_inline byte& Tile::m3 | ( |  | ) |
| inline

General purpose.

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

Parameters

  tile | The tile to get the data for.

Returns
  reference to the byte holding the data.

Definition at line 137 of file map_func.h.

Referenced by ClearSnow(), GetCleanHouseType(), GetFieldType(), GetHouseTriggers(), GetIndustryRandomBits(), GetObjectRandomBits(), GetPresentSignals(), GetStationTileRandomBits(), GetTreeType(), IsHouseCompleted(), IsSnowTile(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeSnow(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), SetFieldType(), SetHouseCompleted(), SetHouseTriggers(), SetHouseType(), SetIndustryRandomBits(), SetPresentSignals(), and SetStationTileRandomBits().

## ◆ m4()

debug_inline byte& Tile::m4 | ( |  | ) |
| inline

General purpose.

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

Parameters

  tile | The tile to get the data for.

Returns
  reference to the byte holding the data.

Definition at line 149 of file map_func.h.

Referenced by GetCleanHouseType(), GetCustomStationSpecIndex(), GetIndustryAnimationLoop(), GetSignalStates(), GetWaterTileRandomBits(), IsCustomStationSpecIndex(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), SetCustomStationSpecIndex(), SetHouseType(), SetIndustryAnimationLoop(), and SetSignalStates().

## ◆ m5()

debug_inline byte& Tile::m5 | ( |  | ) |
| inline

General purpose.

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

Parameters

  tile | The 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(), 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()

debug_inline byte& Tile::m6 | ( |  | ) |
| inline

General purpose.

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

Parameters

  tile | The tile to get the data for.

Returns
  reference to the byte holding the data.

Definition at line 173 of file map_func.h.

Referenced by CanStationTileHavePylons(), CanStationTileHaveWires(), DecHouseProcessingTime(), GetBridgeType(), GetCleanIndustryGfx(), GetHouseProcessingTime(), GetIndustryTriggers(), GetLiftPosition(), GetRoadside(), GetStationType(), HasStationReservation(), IsStationTileBlocked(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveBuoysToWaypoints(), SetHouseProcessingTime(), SetIndustryGfx(), SetIndustryTriggers(), SetLiftPosition(), SetRailStationReservation(), SetRoadside(), SetStationTileBlocked(), SetStationTileHavePylons(), and SetStationTileHaveWires().

## ◆ m7()

debug_inline byte& Tile::m7 | ( |  | ) |
| inline

Primarily used for newgrf support.

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

Parameters

  tile | The tile to get the data for.

Returns
  reference to the byte holding the data.

Definition at line 185 of file map_func.h.

Referenced by GetAnimationFrame(), GetLiftDestination(), HaltLift(), HasTunnelBridgeSnowOrDesert(), IncreaseRoadWorksCounter(), IsOnSnow(), LiftHasDestination(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), SetAnimationFrame(), SetLiftDestination(), SetTunnelBridgeSnowOrDesert(), TerminateRoadWorks(), and ToggleSnow().

## ◆ m8()

debug_inline uint16_t& Tile::m8 | ( |  | ) |
| inline

General purpose.

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

Parameters

  tile | The 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(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadTunnel(), MakeStation(), SetCustomRoadStopSpecIndex(), and SetRailType().

## ◆ type()

debug_inline byte& 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

  tile | The 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:

- src/map_func.h
- src/map.cpp