OpenTTD Source: src/tile_map.h File Reference

OpenTTD Source 14.0-beta1

Functions
tile_map.h File Reference
`#include "slope_type.h"`
`#include "map_func.h"`
`#include "core/bitmath_func.hpp"`
`#include "settings_type.h"`

Go to the source code of this file.

## Functions
static debug_inline uint | TileHeight (Tile tile)
| Returns the height of a tile. More...
uint | TileHeightOutsideMap (int x, int y)
| Returns the height of a tile, also for tiles outside the map (virtual "black" tiles). More...
void | SetTileHeight (Tile tile, uint height)
| Sets the height of a tile. More...
uint | TilePixelHeight (Tile tile)
| Returns the height of a tile in pixels. More...
uint | TilePixelHeightOutsideMap (int x, int y)
| Returns the height of a tile in pixels, also for tiles outside the map (virtual "black" tiles). More...
static debug_inline TileType | GetTileType (Tile tile)
| Get the tiletype of a given tile. More...
bool | IsInnerTile (Tile tile)
| Check if a tile is within the map (not a border) More...
void | SetTileType (Tile tile, TileType type)
| Set the type of a tile. More...
static debug_inline bool | IsTileType (Tile tile, TileType type)
| Checks if a tile is a given tiletype. More...
bool | IsValidTile (Tile tile)
| Checks if a tile is valid. More...
Owner | GetTileOwner (Tile tile)
| Returns the owner of a tile. More...
void | SetTileOwner (Tile tile, Owner owner)
| Sets the owner of a tile. More...
bool | IsTileOwner (Tile tile, Owner owner)
| Checks if a tile belongs to the given owner. More...
void | SetTropicZone (Tile tile, TropicZone type)
| Set the tropic zone. More...
TropicZone | GetTropicZone (Tile tile)
| Get the tropic zone. More...
byte | GetAnimationFrame (Tile t)
| Get the current animation frame. More...
void | SetAnimationFrame (Tile t, byte frame)
| Set a new animation frame. More...
Slope | GetTileSlope (TileIndex tile, int *h=nullptr)
| Return the slope of a given tile inside the map. More...
int | GetTileZ (TileIndex tile)
| Get bottom height of the tile. More...
int | GetTileMaxZ (TileIndex tile)
| Get top height of the tile inside the map. More...
bool | IsTileFlat (TileIndex tile, int *h=nullptr)
| Check if a given tile is flat. More...
Slope | GetTilePixelSlope (TileIndex tile, int *h)
| Return the slope of a given tile. More...
Slope | GetTilePixelSlopeOutsideMap (int x, int y, int *h)
| Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles). More...
int | GetTilePixelZ (TileIndex tile)
| Get bottom height of the tile. More...
int | GetTileMaxPixelZ (TileIndex tile)
| Get top height of the tile. More...
uint | TileHash (uint x, uint y)
| Calculate a hash value from a tile position. More...
uint | TileHash2Bit (uint x, uint y)
| Get the last two bits of the TileHash from a tile position. More...

## Detailed Description

Map writing/reading functions for tiles.

Definition in file tile_map.h.

## Function Documentation

## ◆ GetAnimationFrame()

byte GetAnimationFrame | ( | Tile | t | ) |
| inline

Get the current animation frame.

Parameters

  t | the tile

Precondition
  IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)

Returns
  frame number

Definition at line 250 of file tile_map.h.

References IsTileType(), Tile::m7(), MP_HOUSE, MP_INDUSTRY, MP_OBJECT, and MP_STATION.

Referenced by IndustryTileScopeResolver::GetVariable(), AirportTileScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), and IncreaseAnimationStage().

## ◆ GetTileMaxPixelZ()

int GetTileMaxPixelZ | ( | TileIndex | tile | ) |
| inline

Get top height of the tile.

Parameters

  tile | Tile to compute height of

Returns
  Maximum height of the tile

Definition at line 304 of file tile_map.h.

References GetTileMaxZ(), and TILE_HEIGHT.

Referenced by EnsureNoVehicleOnGround().

## ◆ GetTileMaxZ()

int GetTileMaxZ | ( | TileIndex | t | ) |

Get top height of the tile inside the map.

Parameters

  t | Tile to compute height of

Returns
  Maximum height of the tile

Definition at line 141 of file tile_map.cpp.

References Map::MaxX(), Map::MaxY(), TileHeight(), TileX(), TileXY(), and TileY().

Referenced by AutoslopeCheckForEntranceEdge(), BuildTownHouse(), CheckBuildHouseSameZ(), DrawRoadTypeCatenary(), FloodVehicleProc(), GetOtherAqueductEnd(), GetTileMaxPixelZ(), RiverMakeWider(), and ShipTestUpDownOnLock().

## ◆ GetTileOwner()

Owner GetTileOwner | ( | Tile | tile | ) |
| inline

Returns the owner of a tile.

This function returns the owner of a tile. This cannot used for tiles which type is one of MP_HOUSE, MP_VOID and MP_INDUSTRY as no company owned any of these buildings.

Parameters

  tile | The tile to check

Returns
  The owner of the tile

Precondition
  IsValidTile(tile)
  The type of the tile must not be MP_HOUSE and MP_INDUSTRY

Definition at line 178 of file tile_map.h.

References GB(), IsTileType(), IsValidTile(), Tile::m1(), MP_HOUSE, and MP_INDUSTRY.

Referenced by AfterLoadCompanyStats(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CheckTileOwnership(), CmdConvertRail(), FixOwnerOfRailTrack(), GetTrainForReservation(), ObjectScopeResolver::GetVariable(), IsTileOwner(), MakeBuoy(), MakeLock(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), RemoveLock(), and UpdateObjectColours().

## ◆ GetTilePixelSlope()

Slope GetTilePixelSlope | ( | TileIndex | tile,
|  | int * | h
| ) |  |
| inline

Return the slope of a given tile.

Parameters

  tile | Tile to compute slope of
  h | If not `nullptr`, pointer to storage of z height

Returns
  Slope of the tile, except for the HALFTILE part

Definition at line 280 of file tile_map.h.

References GetTileSlope(), and TILE_HEIGHT.

Referenced by GetNearbyTileInformation().

## ◆ GetTilePixelSlopeOutsideMap()

Slope GetTilePixelSlopeOutsideMap | ( | int | x,
|  | int | y,
|  | int * | h
| ) |  |

Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles).

Parameters

  x | X coordinate of the tile to compute slope of, may be outside the map.
  y | Y coordinate of the tile to compute slope of, may be outside the map.
  h | If not `nullptr`, pointer to storage of z height.

Returns
  Slope of the tile, except for the HALFTILE part.

Definition at line 82 of file tile_map.cpp.

## ◆ GetTilePixelZ()

int GetTilePixelZ | ( | TileIndex | tile | ) |
| inline

Get bottom height of the tile.

Parameters

  tile | Tile to compute height of

Returns
  Minimum height of the tile

Definition at line 294 of file tile_map.h.

References GetTileZ(), and TILE_HEIGHT.

## ◆ GetTileSlope()

Slope GetTileSlope | ( | TileIndex | tile,
|  | int * | h
| ) |  |

Return the slope of a given tile inside the map.

Parameters

  tile | Tile to compute slope of
  h | If not `nullptr`, pointer to storage of z height

Returns
  Slope of the tile, except for the HALFTILE part

Definition at line 59 of file tile_map.cpp.

References GetTileSlopeGivenHeight(), Map::MaxX(), Map::MaxY(), TileHeight(), TileX(), TileXY(), and TileY().

Referenced by BuildTownHouse(), CanBuildHouseHere(), CanPlantTreesOnTile(), CheckBuildableTile(), CmdBuildLock(), CmdBuildRoadDepot(), CmdBuildTrainDepot(), FlowsDown(), GetBridgeHeight(), GetFloodingBehaviour(), GetFoundationSlope(), GetOtherAqueductEnd(), GetTilePixelSlope(), StationScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), GrowTownWithBridge(), GrowTownWithTunnel(), IsRoadAllowedHere(), PerformStationTileSlopeCheck(), RedundantBridgeExistsNearby(), RiverMakeWider(), SearchTileForStatue(), ShipTestUpDownOnLock(), and CYapfCostBase::stSlopeCost().

## ◆ GetTileType()

static debug_inline TileType GetTileType | ( | Tile | tile | ) |
| static

Get the tiletype of a given tile.

Parameters

  tile | The tile to get the TileType

Returns
  The tiletype of the tile

Precondition
  tile < Map::Size()

Definition at line 96 of file tile_map.h.

Referenced by AfterLoadCompanyStats(), CanEnterTileOwnerCheck(), CanFollowRoad(), CanPlantTreesOnTile(), ChangeTileOwner(), CheckIfFarEnoughFromConflictingIndustry(), CleanUpRoadBits(), ClosestTownFromTile(), CmdConvertRail(), DrawRailCatenary(), GetAnyRoadBits(), GetDepotVehicleType(), GetFloodingBehaviour(), GetFoundationSlope(), GetGrfSpecFeature(), GetNearbyTileInformation(), GetRailTrackBitsUniversal(), GetReservedTrackbits(), SmallMapWindow::GetTileColours(), GetTileRailType(), GetTileTrackStatus(), GrowTownWithExtraHouse(), Depot::IsOfType(), IsSuitableForFarmField(), IsWateredTile(), MayHaveRoad(), CYapfCostRoadT< Types >::OneTileCost(), CYapfCostRailT< Types >::OneTileCost(), PlantTreesOnTile(), SetWaterClassDependingOnSurroundings(), TryReserveRailTrack(), UnreserveRailTrack(), UpdateSignalsInBuffer(), and Town::~Town().

## ◆ GetTileZ()

int GetTileZ | ( | TileIndex | tile | ) |

Get bottom height of the tile.

Parameters

  tile | Tile to compute height of

Returns
  Minimum height of the tile

Definition at line 121 of file tile_map.cpp.

References Map::MaxX(), Map::MaxY(), TileHeight(), TileX(), TileXY(), and TileY().

Referenced by CheckNewIndustry_BubbleGen(), FlowRiver(), GetOtherTunnelEnd(), GetTilePixelZ(), CanalScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), GrowTownWithTunnel(), IsTunnelInWayDir(), RiverMakeWider(), ShipTestUpDownOnLock(), and TileLoopClearAlps().

## ◆ GetTropicZone()

TropicZone GetTropicZone | ( | Tile | tile | ) |
| inline

Get the tropic zone.

Parameters

  tile | the tile to get the zone of

Precondition
  tile < Map::Size()

Returns
  the zone type

Definition at line 238 of file tile_map.h.

References GB(), Map::Size(), and Tile::type().

Referenced by CheckNewIndustry_Lumbermill(), CheckNewIndustry_Plantation(), CheckNewIndustry_Water(), NeighbourIsNormal(), and RiverModifyDesertZone().

## ◆ IsInnerTile()

bool IsInnerTile | ( | Tile | tile | ) |
| inline

Check if a tile is within the map (not a border)

Parameters

  tile | The tile to check

Returns
  Whether the tile is in the interior of the map

Precondition
  tile < Map::Size()

Definition at line 109 of file tile_map.h.

References Map::Size().

Referenced by SetTileType(), and TgenSetTileHeight().

## ◆ IsTileFlat()

bool IsTileFlat | ( | TileIndex | tile,
|  | int * | h
| ) |  |

Check if a given tile is flat.

Parameters

  tile | Tile to check
  h | If not `nullptr`, pointer to storage of z height (only if tile is flat)

Returns
  Whether the tile is flat

Definition at line 100 of file tile_map.cpp.

References Map::MaxX(), Map::MaxY(), TileHeight(), TileX(), TileXY(), and TileY().

Referenced by CheckIfIndustryTilesAreFree(), CmdBuildBuoy(), CmdBuildShipDepot(), FindFurthestFromWater(), FindSpring(), MakeLake(), RiverMakeWider(), SetWaterClassDependingOnSurroundings(), TownCanBePlacedHere(), and TryBuildTransmitter().

## ◆ IsTileOwner()

bool IsTileOwner | ( | Tile | tile,
|  | Owner | owner
| ) |  |
| inline

Checks if a tile belongs to the given owner.

Parameters

  tile | The tile to check
  owner | The owner to check against

Returns
  True if a tile belongs the the given owner

Definition at line 214 of file tile_map.h.

References GetTileOwner().

Referenced by CanEnterTileOwnerCheck(), CmdBuildVehicle(), CmdDepotMassAutoReplace(), CmdDepotSellAllVehicles(), CmdMassStartStopVehicle(), DoClearBridge(), DoClearTunnel(), GetOrderCmdFromTile(), and TestTownOwnsBridge().

## ◆ IsTileType()

static debug_inline bool IsTileType | ( | Tile | tile,
|  | TileType | type
| ) |  |
| static

Checks if a tile is a given tiletype.

This function checks if a tile has the given tiletype.

Parameters

  tile | The tile to check
  type | The type to check against

Returns
  true If the type matches against the type of the tile

Definition at line 150 of file tile_map.h.

Referenced by AddClearCounter(), AddClearDensity(), AddTreeCount(), AddTreeGrowth(), AdjustTileh(), AdvanceSingleHouseConstruction(), AmbientSoundEffectCallback(), Vehicle::BeginLoading(), CalculateRoadStopCost(), CanEnterTile(), CanEnterTileOwnerCheck(), CanRoadContinueIntoNextTile(), Station::CatchmentCoversTown(), CheckFlatLandRoadStop(), CheckForDockingTile(), CheckIfIndustryTilesAreFree(), CheckSubsidised(), ClearPathReservation(), ClearTownHouse(), CmdBuildLongRoad(), CmdRemoveRoadStop(), CmdTerraformLand(), CMSAMine(), CMSATree(), CMSAWater(), Train::Crash(), DecHouseProcessingTime(), DoClearTownHouseHelper(), DoFloodTile(), DoTriggerIndustryTile(), DrawRoadCatenary(), ExtendTrainReservation(), FindFurthestFromWater(), FindNearestEmptyLand(), FindNearIndustryName(), FindRailStationEnd(), FindSubsidyCargoDestination(), FindSubsidyTownCargoRoute(), FollowReservation(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), FollowTrainReservation(), ForAllStationsAroundTiles(), FreeTrainTrackReservation(), GetAcceptanceAroundTiles(), GetAnimationFrame(), GetAxisForNewWaypoint(), GetCleanHouseType(), GetCleanIndustryGfx(), GetClearCounter(), GetClearDensity(), GetEffectiveWaterClass(), GetHouseAge(), GetHouseBuildingStage(), GetHouseConstructionTick(), GetHouseProcessingTime(), GetHouseRandomBits(), GetHouseTriggers(), GetIndustryAnimationLoop(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetIndustryGfx(), GetIndustryIndex(), GetIndustryRandomBits(), GetIndustryTriggers(), GetIndustryType(), GetNearbyAirportTileInformation(), GetNearbyIndustryTileInformation(), GetNearbyObjectTileInformation(), GetNearbyTileInformation(), GetObjectIDAtOffset(), GetObjectIndex(), GetObjectRandomBits(), GetObjectType(), GetOrderCmdFromTile(), GetOtherTunnelBridgeEnd(), GetProductionAroundTiles(), CanalScopeResolver::GetRandomBits(), HouseScopeResolver::GetRandomBits(), ObjectScopeResolver::GetRandomBits(), GetRawClearGround(), GetStationGfx(), GetStationIndex(), StationFinder::GetStations(), GetStationTileRandomBits(), GetStationType(), GetTileCatchmentRadius(), GetTileHighlightType(), GetTileOwner(), GetTownIndex(), GetTrainForReservation(), GetTreeCount(), GetTreeDensity(), GetTreeGround(), GetTreeGrowth(), GetTreeType(), HouseScopeResolver::GetTriggers(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), CanalScopeResolver::GetVariable(), IndustryTileScopeResolver::GetVariable(), HouseScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), GetWaterTileRandomBits(), GetWaterTileType(), HasOnewaySignalBlockingTrackdir(), HasPbsSignalOnTrackdir(), HasStationTileRail(), HasTileWaterClass(), HasTunnelBridgeReservation(), HasTunnelBridgeSnowOrDesert(), IncHouseConstructionTick(), IncrementHouseAge(), IsAirportTile(), IsBridge(), IsBridgeTile(), IsBuoyTile(), IsCoastTile(), IsDockingTile(), IsDockTile(), RoadStop::IsDriveThroughRoadStopContinuation(), IsHangar(), IsHangarTile(), IsHouseCompleted(), IsIndustryCompleted(), IsLevelCrossingTile(), IsObjectTypeTile(), IsPossibleCrossing(), IsRailStationTile(), IsRailWaypointTile(), IsRoadStop(), IsRoadStopTile(), IsSafeWaitingPosition(), IsShipDepotTile(), IsShipDestinationTile(), IsSnowTile(), IsTileForestIndustry(), IsTunnel(), IsTunnelTile(), IsValidTile(), IsValidTileForWaypoint(), IsWaitingPositionFree(), IsWaterTile(), MakeHouseTile(), MarkTileDirtyIfCanalOrRiver(), MayHaveBridgeAbove(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), Station::RecomputeCatchment(), ResetHouseAge(), ResetIndustryConstructionStage(), RoadTypesAllowHouseHere(), StationRect::ScanForStationTiles(), SearchLumberMillTrees(), SearchNearbyHouseClass(), SearchNearbyHouseGRFID(), SearchNearbyHouseID(), SearchTileForStatue(), SetAnimationFrame(), SetClearCounter(), SetClearDensity(), SetClearGroundDensity(), SetDockingTile(), SetHouseCompleted(), SetHouseProcessingTime(), SetHouseRandomBits(), SetHouseTriggers(), SetHouseType(), SetIndustryAnimationLoop(), SetIndustryCompleted(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetIndustryGfx(), SetIndustryRandomBits(), SetIndustryTriggers(), SetStationGfx(), SetStationTileRandomBits(), SetTileOwner(), SetTownIndex(), SetTreeGroundDensity(), SetTreeGrowth(), SetTropicZone(), SetTunnelBridgeReservation(), SetTunnelBridgeSnowOrDesert(), SetupFarmFieldFence(), ShipTestUpDownOnLock(), TestTownOwnsBridge(), Industry::TileBelongsToIndustry(), TileLoop_Water(), TownCanBePlacedHere(), TownCanGrowRoad(), TrainCanLeaveTile(), TriggerWatchedCargoCallbacks(), TryBuildTransmitter(), UpdateHousesAndTowns(), UpdateNearestTownForRoadTiles(), UpdateStatusAfterSwap(), and WatchedCargoCallback().

## ◆ IsValidTile()

bool IsValidTile | ( | Tile | tile | ) |
| inline

Checks if a tile is valid.

Parameters

  tile | The tile to check

Returns
  True if the tile is on the map and not one of MP_VOID.

Definition at line 161 of file tile_map.h.

References IsTileType(), MP_VOID, and Map::Size().

Referenced by CalculateCoverageLine(), CanConnectToRoad(), CanFollowRoad(), CanRoadContinueIntoNextTile(), CheckForDockingTile(), CheckIfIndustryTilesAreFree(), CleanUpRoadBits(), ClearDockingTilesCheckingNeighbours(), CmdBuildBridge(), CmdCustomNewsItem(), CmdRemoveRoadStop(), CmdStoryPageButton(), DisasterTick_Submarine(), CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), true >::Do(), DoTriggerIndustryTile(), DrawTileSelectionRect(), FindDockLandPart(), GetOtherAqueductEnd(), IndustryTileScopeResolver::GetRandomBits(), HouseScopeResolver::GetRandomBits(), ObjectScopeResolver::GetRandomBits(), GetTileOwner(), IndustryTileScopeResolver::GetTriggers(), HouseScopeResolver::GetTriggers(), ObjectScopeResolver::GetVariable(), GrowTownWithBridge(), GrowTownWithTunnel(), GoalListWindow::HandleClick(), IsNeighborRoadTile(), IsShipDestinationTile(), IsTunnelInWayDir(), IsValidLink(), MakeLake(), MarkTileDirtyIfCanalOrRiver(), NeighbourIsNormal(), RedundantBridgeExistsNearby(), RiverMakeWider(), RoadTypesAllowHouseHere(), SetTileOwner(), TileLoop_Water(), and VerifyElementContentParameters().

## ◆ SetAnimationFrame()

void SetAnimationFrame | ( | Tile | t,
|  | byte | frame
| ) |  |
| inline

Set a new animation frame.

Parameters

  t | the tile
  frame | the new frame number

Precondition
  IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)

Definition at line 262 of file tile_map.h.

References IsTileType(), Tile::m7(), MP_HOUSE, MP_INDUSTRY, MP_OBJECT, and MP_STATION.

Referenced by IncreaseAnimationStage(), and MakeHouseTile().

## ◆ SetTileHeight()

void SetTileHeight | ( | Tile | tile,
|  | uint | height
| ) |  |
| inline

Sets the height of a tile.

This function sets the height of the northern corner of a tile.

Parameters

  tile | The tile to change the height
  height | The new height value of the tile

Precondition
  tile < Map::Size()
  height <= MAX_TILE_HEIGHT

Definition at line 57 of file tile_map.h.

References Tile::height(), MAX_TILE_HEIGHT, and Map::Size().

Referenced by FlatEmptyWorld(), MakeVoid(), and TgenSetTileHeight().

## ◆ SetTileOwner()

void SetTileOwner | ( | Tile | tile,
|  | Owner | owner
| ) |  |
| inline

Sets the owner of a tile.

This function sets the owner status of a tile. Note that you cannot set a owner for tiles of type MP_HOUSE, MP_VOID and MP_INDUSTRY.

Parameters

  tile | The tile to change the owner status.
  owner | The new owner.

Precondition
  IsValidTile(tile)
  The type of the tile must not be MP_HOUSE and MP_INDUSTRY

Definition at line 198 of file tile_map.h.

References IsTileType(), IsValidTile(), Tile::m1(), MP_HOUSE, MP_INDUSTRY, and SB().

Referenced by FixOwnerOfRailTrack(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeWater(), and SetTunnelBridgeOwner().

## ◆ SetTileType()

void SetTileType | ( | Tile | tile,
|  | TileType | type
| ) |  |
| inline

Set the type of a tile.

This functions sets the type of a tile. If the type MP_VOID is selected the tile must be at the south-west or south-east edges of the map and vice versa.

Parameters

  tile | The tile to save the new type
  type | The type to save

Precondition
  tile < Map::Size()
  type MP_VOID <=> tile is on the south-east or south-west edge.

Definition at line 131 of file tile_map.h.

References IsInnerTile(), MP_VOID, SB(), Map::Size(), and Tile::type().

Referenced by MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeRailDepot(), MakeRailTunnel(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadTunnel(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeVoid(), and MakeWater().

## ◆ SetTropicZone()

void SetTropicZone | ( | Tile | tile,
|  | TropicZone | type
| ) |  |
| inline

Set the tropic zone.

Parameters

  tile | the tile to set the zone of
  type | the new type

Precondition
  tile < Map::Size()

Definition at line 225 of file tile_map.h.

References IsTileType(), MP_VOID, SB(), Map::Size(), TROPICZONE_NORMAL, and Tile::type().

Referenced by RiverModifyDesertZone().

## ◆ TileHash()

uint TileHash | ( | uint | x,
|  | uint | y
| ) |  |
| inline

Calculate a hash value from a tile position.

Parameters

  x | The X coordinate
  y | The Y coordinate

Returns
  The hash of the tile

Definition at line 316 of file tile_map.h.

Referenced by Town::InitializeLayout(), and River_Hash().

## ◆ TileHash2Bit()

uint TileHash2Bit | ( | uint | x,
|  | uint | y
| ) |  |
| inline

Get the last two bits of the TileHash from a tile position.

See also
  TileHash()

Parameters

  x | The X coordinate
  y | The Y coordinate

Returns
  The last two bits from hash of the tile

Definition at line 334 of file tile_map.h.

Referenced by HouseScopeResolver::GetVariable().

## ◆ TileHeight()

static debug_inline uint TileHeight | ( | Tile | tile | ) |
| static

Returns the height of a tile.

This function returns the height of the northern corner of a tile. This is saved in the global map-array. It does not take affect by any slope-data of the tile.

Parameters

  tile | The tile to get the height from

Returns
  the height of the tile

Precondition
  tile < Map::Size()

Definition at line 29 of file tile_map.h.

Referenced by CalculateCoverageLine(), CheckIfCanLevelIndustryPlatform(), ClickChangeMaxHlCheat(), CmdLevelLand(), CmdTerraformLand(), FlowRiver(), GetTileHeightBelowAircraft(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), IsTileFlat(), MakeHeightmapScreenshot(), MakeLake(), MarkBridgeDirty(), MarkTileDirtyByTile(), TerraformGetHeightOfTile(), and TilePixelHeight().

## ◆ TileHeightOutsideMap()

uint TileHeightOutsideMap | ( | int | x,
|  | int | y
| ) |  |
| inline

Returns the height of a tile, also for tiles outside the map (virtual "black" tiles).

Parameters

  x | X coordinate of the tile, may be outside the map.
  y | Y coordinate of the tile, may be outside the map.

Returns
  The height in the same unit as TileHeight.

Definition at line 42 of file tile_map.h.

## ◆ TilePixelHeight()

uint TilePixelHeight | ( | Tile | tile | ) |
| inline

Returns the height of a tile in pixels.

This function returns the height of the northern corner of a tile in pixels.

Parameters

  tile | The tile to get the height

Returns
  The height of the tile in pixel

Definition at line 72 of file tile_map.h.

References TILE_HEIGHT, and TileHeight().

## ◆ TilePixelHeightOutsideMap()

uint TilePixelHeightOutsideMap | ( | int | x,
|  | int | y
| ) |  |
| inline

Returns the height of a tile in pixels, also for tiles outside the map (virtual "black" tiles).

Parameters

  x | X coordinate of the tile, may be outside the map.
  y | Y coordinate of the tile, may be outside the map.

Returns
  The height in pixels in the same unit as TilePixelHeight.

Definition at line 84 of file tile_map.h.

Referenced by GetViewportY().