# tile_map.cpp File Reference

Global tile accessors. More...

`#include "stdafx.h"`
`#include "tile_map.h"`
`#include "core/math_func.hpp"`
`#include "settings_type.h"`

Go to the source code of this file.

## Functions
Slope | GetTileSlope (TileIndex tile, uint *h)
| Return the slope of a given tile.
uint | GetTileZ (TileIndex tile)
| Get bottom height of the tile.
uint | GetTileMaxZ (TileIndex t)
| Get top height of the tile.

## Detailed Description

Global tile accessors.

Definition in file tile_map.cpp.

## Function Documentation

uint GetTileMaxZ | ( | TileIndex | t | ) |

Get top height of the tile.

Parameters:

  | tile | Tile to compute height of

Returns:
  Maximum height of the tile

Definition at line 76 of file tile_map.cpp.

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

Referenced by AutoslopeCheckForEntranceEdge(), BuildTownHouse(), CheckBuildHouseSameZ(), CmdBuildBridge(), DrawCatenary(), DrawCatenaryRailway(), DrawRoadBits(), and DrawTramCatenary().

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

Return the slope of a given tile.

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

References _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, MapMaxX(), MapMaxY(), MapSize(), min(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_W, TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().

Referenced by BuildTownHouse(), CanBuildHouseHere(), CanPlantTreesOnTile(), CheckFlatLandBelow(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildDock(), CmdBuildLock(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildShipDepot(), CmdBuildSingleRail(), CmdBuildTown(), CmdBuildTrainDepot(), CmdBuildTrainWaypoint(), CmdBuildTunnel(), CmdPlantTree(), CmdRemoveSingleRail(), DoBuildShiplift(), DoFloodTile(), DrawCatenaryRailway(), FloodHalftile(), GetBridgeHeight(), GetFloodingBehaviour(), GetFoundationSlope(), GetNearbyTileInformation(), AITile::GetSlope(), GetTownRoadGridElement(), GrowTown(), GrowTownWithBridge(), IsRoadAllowedHere(), IsWateredTile(), RemoveRoad(), and SetWaterClassDependingOnSurroundings().

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

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

Referenced by DrawCatenaryOnTunnel(), GetOtherTunnelEnd(), GetTerrainType(), IsTunnelInWayDir(), MarkTileDirty(), MarkTileDirtyByTile(), PlaceTreeAtSameHeight(), and PlaceTreesRandomly().