OpenTTD Source 20241224-master-gf74b0cf984
|
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 TileBase * | base_tiles = nullptr |
Pointer to the tile-array. | |
static TileExtended * | extended_tiles = nullptr |
Pointer to the extended tile-array. | |
Friends | |
struct | Map |
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.
|
inline |
Create the tile wrapper for the given tile.
tile | The tile to access the map for. |
Definition at line 64 of file map_func.h.
|
inline |
Create the tile wrapper for the given tile.
tile | The tile to access the map for. |
Definition at line 70 of file map_func.h.
|
inline |
The height of the northern corner.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the height for. |
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().
|
inline |
Primarily used for ownership information.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 113 of file map_func.h.
References base_tiles, Tile::TileBase::m1, and tile.
Referenced by GetHouseRandomBits(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetRoadOwner(), GetTileOwner(), GetWaterClass(), IsDockingTile(), IsIndustryCompleted(), MAPOChunkHandler::Load(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeVoid(), ResetIndustryConstructionStage(), MAPOChunkHandler::Save(), SetDockingTile(), SetHouseRandomBits(), SetIndustryCompleted(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetRoadOwner(), SetTileOwner(), and SetWaterClass().
|
inline |
Primarily used for indices to towns, industries and stations.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 125 of file map_func.h.
References base_tiles, Tile::TileBase::m2, and tile.
Referenced by AfterLoadGame(), GetDepotIndex(), GetIndustryIndex(), GetIndustryIndexOfField(), GetObjectIndex(), GetRailReservationTrackBits(), GetStationIndex(), GetTownIndex(), GetTreeDensity(), GetTreeGround(), MAP2ChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), MAP2ChunkHandler::Save(), SetIndustryIndexOfField(), SetTownIndex(), SetTrackReservation(), SetTreeGroundDensity(), and SetWaterClassDependingOnSurroundings().
|
inline |
General purpose.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 137 of file map_func.h.
References base_tiles, Tile::TileBase::m3, and tile.
Referenced by CanStationTileHavePylons(), CanStationTileHaveWires(), ClearSnow(), FixOwnerOfRailTrack(), GetFence(), GetFieldType(), GetHouseTriggers(), GetIndustryRandomBits(), GetObjectRandomBits(), GetPresentSignals(), GetRoadBits(), GetRoadOwner(), GetRoadWaypointRoadside(), GetStationTileRandomBits(), GetTreeType(), IsHouseCompleted(), IsNonFloodingWaterTile(), IsSnowTile(), IsStationTileBlocked(), M3LOChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeSnow(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), M3LOChunkHandler::Save(), SetFence(), SetFieldType(), SetHouseCompleted(), SetHouseTriggers(), SetIndustryRandomBits(), SetNonFloodingWaterTile(), SetPresentSignals(), SetRoadBits(), SetRoadOwner(), SetRoadWaypointRoadside(), SetStationTileBlocked(), SetStationTileHavePylons(), SetStationTileHaveWires(), and SetStationTileRandomBits().
|
inline |
General purpose.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 149 of file map_func.h.
References base_tiles, Tile::TileBase::m4, and tile.
Referenced by GetCustomStationSpecIndex(), GetFence(), GetIndustryAnimationLoop(), GetSignalStates(), GetWaterTileRandomBits(), IsCustomStationSpecIndex(), M3HIChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveWaypointsToBaseStations(), M3HIChunkHandler::Save(), SetCustomStationSpecIndex(), SetFence(), SetIndustryAnimationLoop(), SetRoadTypeRoad(), and SetSignalStates().
|
inline |
General purpose.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
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().
|
inline |
General purpose.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 173 of file map_func.h.
References extended_tiles, Tile::TileExtended::m6, and tile.
Referenced by DecHouseProcessingTime(), FixOwnerOfRailTrack(), GetAnimatedTileState(), GetBridgeType(), GetCleanIndustryGfx(), GetFence(), GetHouseProcessingTime(), GetIndustryTriggers(), GetLiftPosition(), GetRoadside(), GetStationType(), HasStationReservation(), MAPEChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MoveBuoysToWaypoints(), MAPEChunkHandler::Save(), SetAnimatedTileState(), SetFence(), SetHouseProcessingTime(), SetIndustryGfx(), SetIndustryTriggers(), SetLiftPosition(), SetRailStationReservation(), and SetRoadside().
|
inline |
Primarily used for newgrf support.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 185 of file map_func.h.
References extended_tiles, Tile::TileExtended::m7, and tile.
Referenced by FixOwnerOfRailTrack(), GetAnimationFrame(), GetLiftDestination(), GetRoadOwner(), HaltLift(), HasTunnelBridgeSnowOrDesert(), IncreaseRoadWorksCounter(), IsOnSnow(), LiftHasDestination(), MAP7ChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), MakeWater(), MAP7ChunkHandler::Save(), SetAnimationFrame(), SetLiftDestination(), SetRoadOwner(), SetTunnelBridgeSnowOrDesert(), TerminateRoadWorks(), and ToggleSnow().
|
inline |
General purpose.
Look at docs/landscape.html for the exact meaning of the data.
tile | The tile to get the data for. |
Definition at line 197 of file map_func.h.
References extended_tiles, Tile::TileExtended::m8, and tile.
Referenced by GetCleanHouseType(), GetCustomRoadStopSpecIndex(), GetRailType(), IsCustomRoadStopSpecIndex(), IsRoadWaypointOnSnowOrDesert(), MAP8ChunkHandler::Load(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadTunnel(), MakeStation(), MAP8ChunkHandler::Save(), SetCustomRoadStopSpecIndex(), SetHouseType(), SetRailType(), SetRoadTypeTram(), and ToggleRoadWaypointOnSnowOrDesert().
|
inlineconstexpr |
|
inlineconstexpr |
Implicit conversion to the uint for bounds checking.
Definition at line 80 of file map_func.h.
References tile.
|
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.
tile | The tile to get the data for. |
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().
|
friend |
Definition at line 27 of file map_func.h.
|
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().
|
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().
|
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().