Functions

# tile_map.cpp File Reference

Global tile accessors. More...

`#include "stdafx.h"`
`#include "tile_map.h"`

Go to the source code of this file.

## Functions
static Slope | GetTileSlopeGivenHeight (uint hnorth, uint hwest, uint heast, uint hsouth, uint *h)
Slope | GetTileSlope (TileIndex tile, uint *h)
| Return the slope of a given tile inside the map.
Slope | GetTileSlopeOutsideMap (int x, int y, uint *h)
| Return the slope of a given tile outside the map.
uint | GetTileZ (TileIndex tile)
| Get bottom height of the tile inside the map.
uint | GetTileZOutsideMap (int x, int y)
| Get bottom height of the tile outside the map.
uint | GetTileMaxZ (TileIndex t)
| Get top height of the tile inside the map.
uint | GetTileMaxZOutsideMap (int x, int y)
| Get top height of the tile the outside map.

## Detailed Description

Global tile accessors.

Definition in file tile_map.cpp.

## Function Documentation

uint 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 130 of file tile_map.cpp.

References MapMaxX(), MapMaxY(), max(), TILE_HEIGHT, TileDiffXY(), TileHeight(), TileHeightOutsideMap(), TileX(), and TileY().

Referenced by AutoslopeCheckForEntranceEdge(), BuildTownHouse(), CheckBuildHouseSameZ(), CmdBuildBridge(), CmdBuildObject(), DoClearBridge(), DrawCatenary(), DrawCatenaryRailway(), DrawRoadBits(), DrawTramCatenary(), EnsureNoVehicleOnGround(), FloodVehicleProc(), AITile::GetMaxHeight(), GetOtherAqueductEnd(), GetTerrainType(), IsTunnelInWayDir(), and VpSelectTilesWithMethod().

uint GetTileMaxZOutsideMap | ( | int | x,
|  | int | y |
| ) |  |  |

Get top height of the tile the outside map.

Returns TileMaxZ for points outside map.

See also:
  Detailed description in header.

Parameters:

  | tile | Tile outside to compute height of.

Returns:
  Maximum height of the tile.

Definition at line 150 of file tile_map.cpp.

References max(), TILE_HEIGHT, and TileHeightOutsideMap().

Referenced by GetViewportY().

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

Return the slope of a given tile inside the map.

Parameters:

  | tile | Tile to compute slope of
  | h | If not `NULL`, 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 _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, GetTileSlopeGivenHeight(), MapMaxX(), MapMaxY(), MapSize(), TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().

Referenced by AfterLoadGame(), BuildTownHouse(), CanBuildHouseHere(), CanPlantTreesOnTile(), CheckBuildableTile(), CheckIfIndustryTilesAreFree(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildDock(), CmdBuildLock(), CmdBuildObject(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildShipDepot(), CmdBuildSingleRail(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdPlantTree(), CmdRemoveSingleRail(), DoBuildLock(), DoFloodTile(), DrawCatenaryRailway(), FindFurthestFromWater(), FloodHalftile(), GetBridgeHeight(), AITile::GetCornerHeight(), GetFloodingBehaviour(), GetFoundationSlope(), GetNearbyTileInformation(), GetOtherAqueductEnd(), AITunnel::GetOtherTunnelEnd(), AITile::GetSlope(), GetTownRoadGridElement(), GrowTown(), GrowTownWithBridge(), IsCrossableWater(), IsRoadAllowedHere(), IsTunnelInWayDir(), IsValidTileForWaypoint(), IsWateredTile(), ObjectGetVariable(), BuildDocksToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlacePresize(), PerformIndustryTileSlopeCheck(), RemoveRoad(), SearchTileForStatue(), SetWaterClassDependingOnSurroundings(), CYapfCostBase::stSlopeCost(), and TownCanBePlacedHere().

static Slope GetTileSlopeGivenHeight | ( | uint | hnorth,
|  | uint | hwest,
|  | uint | heast,
|  | uint | hsouth,
|  | uint * | h |
| ) |  |  | `[static]`

< Computed slope of the tile.

Definition at line 15 of file tile_map.cpp.

References max(), min(), and TILE_HEIGHT.

Referenced by GetTileSlope(), and GetTileSlopeOutsideMap().

Slope GetTileSlopeOutsideMap | ( | int | x,
|  | int | y,
|  | uint * | h |
| ) |  |  |

Return the slope of a given tile outside the map.

Parameters:

  | tile | Tile outside the map to compute slope of.
  | h | If not `NULL`, pointer to storage of z height.

Returns:
  Slope of the tile outside map, except for the HALFTILE part.

Definition at line 83 of file tile_map.cpp.

References GetTileSlopeGivenHeight(), and TileHeightOutsideMap().

uint GetTileZ | ( | TileIndex | tile | ) |

Get bottom height of the tile inside the map.

Parameters:

  | tile | Tile to compute height of

Returns:
  Minimum height of the tile

Definition at line 98 of file tile_map.cpp.

References MapMaxX(), MapMaxY(), min(), TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().

Referenced by CheckNewIndustry_BubbleGen(), CheckNewIndustry_Farm(), CheckNewIndustry_Forest(), DrawCatenaryOnTunnel(), AITile::GetMinHeight(), GetOtherTunnelEnd(), GetTerrainType(), IsCrossableWater(), IsTunnelInWayDir(), IsWaterCrossingTunnel(), MarkTileDirtyByTile(), LandInfoWindow::OnInit(), PlaceTreeAtSameHeight(), PlaceTreesRandomly(), and TileLoopClearAlps().

uint GetTileZOutsideMap | ( | int | x,
|  | int | y |
| ) |  |  |

Get bottom height of the tile outside the map.

Parameters:

  | tile | Tile outside the map to compute height of.

Returns:
  Minimum height of the tile outside map.

Definition at line 115 of file tile_map.cpp.

References min(), TILE_HEIGHT, and TileHeightOutsideMap().