OpenTTD
|
Global tile accessors. More...
Go to the source code of this file.
Functions | |
uint | TileHeightOutsideMap (int x, int y) |
Returns the tile height for a coordinate outside map. | |
static Slope | GetTileSlopeGivenHeight (int hnorth, int hwest, int heast, int hsouth, int *h) |
Get a tile's slope given the heigh of its four corners. | |
Slope | GetTileSlope (TileIndex tile, int *h) |
Return the slope of a given tile inside the map. | |
Slope | GetTilePixelSlopeOutsideMap (int x, int y, int *h) |
Return the slope of a given tile outside the map. | |
bool | IsTileFlat (TileIndex tile, int *h) |
Check if a given tile is flat. | |
int | GetTileZ (TileIndex tile) |
Get bottom height of the tile. | |
int | GetTilePixelZOutsideMap (int x, int y) |
Get bottom height of the tile outside map. | |
int | GetTileMaxZ (TileIndex t) |
Get top height of the tile inside the map. | |
int | GetTileMaxPixelZOutsideMap (int x, int y) |
Get top height of the tile outside the map. |
Global tile accessors.
Definition in file tile_map.cpp.
int GetTileMaxPixelZOutsideMap | ( | int | x, |
int | y | ||
) |
Get top height of the tile outside the map.
tile | Tile outside to compute height of. |
Definition at line 235 of file tile_map.cpp.
References max(), TILE_HEIGHT, and TileHeightOutsideMap().
int GetTileMaxZ | ( | TileIndex | t | ) |
Get top height of the tile inside the map.
t | Tile to compute height of |
Definition at line 215 of file tile_map.cpp.
References MapMaxX(), MapMaxY(), TileDiffXY(), TileHeight(), TileHeightOutsideMap(), TileX(), and TileY().
Referenced by AutoslopeCheckForEntranceEdge(), BuildTownHouse(), CheckBuildHouseSameZ(), CmdBuildBridge(), CmdBuildObject(), DoClearBridge(), DrawRailCatenaryRailway(), DrawRoadBits(), DrawRoadCatenary(), FindSpring(), FloodVehicleProc(), GetOtherAqueductEnd(), GetTerrainType(), and GetTileMaxPixelZ().
Slope GetTilePixelSlopeOutsideMap | ( | int | x, |
int | y, | ||
int * | h | ||
) |
Return the slope of a given tile outside the map.
tile | Tile outside the map to compute slope of. |
h | If not NULL , pointer to storage of z height. |
Definition at line 141 of file tile_map.cpp.
References GetTileSlopeGivenHeight(), TILE_HEIGHT, and TileHeightOutsideMap().
Referenced by ViewportAddLandscape().
int GetTilePixelZOutsideMap | ( | int | x, |
int | y | ||
) |
Get bottom height of the tile outside map.
tile | Tile outside the map to compute height of. |
Definition at line 200 of file tile_map.cpp.
References min(), TILE_HEIGHT, and TileHeightOutsideMap().
Return the slope of a given tile inside the map.
tile | Tile to compute slope of |
h | If not NULL , pointer to storage of z height |
Definition at line 115 of file tile_map.cpp.
References GetTileSlopeGivenHeight(), MapMaxX(), MapMaxY(), MapSize(), SLOPE_FLAT, TileDiffXY(), TileHeight(), TileX(), and TileY().
Referenced by BuildTownHouse(), CanBuildHouseHere(), CanPlantTreesOnTile(), CheckBuildableTile(), CheckIfIndustryTilesAreFree(), CmdBuildBridge(), CmdBuildCanal(), CmdBuildDock(), CmdBuildLock(), CmdBuildObject(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildSingleRail(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdPlantTree(), CmdRemoveSingleRail(), DoFloodTile(), DrawRailCatenaryRailway(), FloodHalftile(), FlowsDown(), GetBridgeHeight(), GetFloodingBehaviour(), GetFoundationSlope(), GetOtherAqueductEnd(), GetTilePixelSlope(), GetTownRoadGridElement(), StationScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), GrowTownWithBridge(), IsRoadAllowedHere(), IsValidTileForWaypoint(), IsWateredTile(), BuildDocksToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlacePresize(), PerformIndustryTileSlopeCheck(), PerformStationTileSlopeCheck(), RemoveRoad(), SearchTileForStatue(), and CYapfCostBase::stSlopeCost().
|
static |
Get a tile's slope given the heigh of its four corners.
hnorth | The height at the northern corner in the same unit as TileHeight. | |
hwest | The height at the western corner in the same unit as TileHeight. | |
heast | The height at the eastern corner in the same unit as TileHeight. | |
hsouth | The height at the southern corner in the same unit as TileHeight. | |
[out] | h | The lowest height of the four corners. |
Definition at line 80 of file tile_map.cpp.
References max(), min(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_STEEP, and SLOPE_W.
Referenced by GetTilePixelSlopeOutsideMap(), and GetTileSlope().
int GetTileZ | ( | TileIndex | tile | ) |
Get bottom height of the tile.
tile | Tile to compute height of |
Definition at line 182 of file tile_map.cpp.
References MapMaxX(), MapMaxY(), min(), TileDiffXY(), TileHeight(), TileX(), and TileY().
Referenced by AmbientSoundEffectCallback(), CheckNewIndustry_BubbleGen(), CheckNewIndustry_Farm(), CheckNewIndustry_Forest(), CmdBuildBridge(), GetOtherTunnelEnd(), GetTerrainType(), GetTilePixelZ(), IndustriesScopeResolver::GetVariable(), CanalScopeResolver::GetVariable(), IsTunnelInWayDir(), LandInfoWindow::OnInit(), PlaceTreeAtSameHeight(), PlaceTreesRandomly(), and TileLoopClearAlps().
bool IsTileFlat | ( | TileIndex | tile, |
int * | h | ||
) |
Check if a given tile is flat.
tile | Tile to check |
h | If not NULL , pointer to storage of z height (only if tile is flat) |
Definition at line 159 of file tile_map.cpp.
References IsInnerTile(), MapSize(), TileDiffXY(), and TileHeight().
Referenced by AfterLoadGame(), CheckIfIndustryTilesAreFree(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildObject(), CmdBuildShipDepot(), DoBuildLock(), FindFurthestFromWater(), FindSpring(), FlowRiver(), GrowTown(), IsWateredTile(), MakeLake(), SetWaterClassDependingOnSurroundings(), TownCanBePlacedHere(), TryBuildLightHouse(), and TryBuildTransmitter().
uint TileHeightOutsideMap | ( | int | x, |
int | y | ||
) |
Returns the tile height for a coordinate outside map.
Such a height is needed for painting the area outside map using completely black tiles. The idea is descending to heightlevel 0 as fast as possible.
x | The X-coordinate (same unit as TileX). |
y | The Y-coordinate (same unit as TileY). |
Definition at line 25 of file tile_map.cpp.
References MapMaxX(), MapMaxY(), max(), TileHeight(), and TileXY().
Referenced by GetTileMaxPixelZOutsideMap(), GetTileMaxZ(), GetTilePixelSlopeOutsideMap(), GetTilePixelZOutsideMap(), ScrollWindowTo(), and TilePixelHeightOutsideMap().