OpenTTD Source: src/tile_type.h File Reference

OpenTTD Source 15.0-RC2

Typedefs | Enumerations | Variables
tile_type.h File Reference

Types related to tiles. More...

`#include "core/strong_typedef_type.hpp"`

Go to the source code of this file.

## Typedefs
using | TileIndex = StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
| The index/ID of a Tile.

## Enumerations
enum | TileType : uint8_t { MP_CLEAR , MP_RAILWAY , MP_ROAD , MP_HOUSE , MP_TREES , MP_STATION , MP_WATER , MP_VOID , MP_INDUSTRY , MP_TUNNELBRIDGE , MP_OBJECT }
| The different types of tiles. More...
enum | TropicZone : uint8_t { TROPICZONE_NORMAL = 0 , TROPICZONE_DESERT = 1 , TROPICZONE_RAINFOREST = 2 }
| Additional infos of a tile on a tropic game. More...

## Variables
static constexpr uint | TILE_SIZE = 16
| Tile size in world coordinates.
static constexpr uint | TILE_UNIT_MASK = TILE_SIZE - 1
| For masking in/out the inner-tile world coordinate units.
static constexpr uint | TILE_PIXELS = 32
| Pixel distance between tile columns/rows in ZOOM_BASE.
static constexpr uint | TILE_HEIGHT = 8
| Height of a height level in world coordinate AND in pixels in ZOOM_BASE.
static constexpr uint | MAX_BUILDING_PIXELS = 200
| Maximum height of a building in pixels in ZOOM_BASE. (Also applies to "bridge buildings" on the bridge floor.)
static constexpr int | MAX_VEHICLE_PIXEL_X = 192
| Maximum width of a vehicle in pixels in ZOOM_BASE.
static constexpr int | MAX_VEHICLE_PIXEL_Y = 96
| Maximum height of a vehicle in pixels in ZOOM_BASE.
static constexpr uint | MAX_TILE_HEIGHT = 255
| Maximum allowed tile height.
static constexpr uint | MIN_HEIGHTMAP_HEIGHT = 1
| Lowest possible peak value for heightmap creation.
static constexpr uint | MIN_CUSTOM_TERRAIN_TYPE = 1
| Lowest possible peak value for world generation.
static constexpr uint | MIN_MAP_HEIGHT_LIMIT = 15
| Lower bound of maximum allowed heightlevel (in the construction settings)
static constexpr uint | MAX_MAP_HEIGHT_LIMIT = MAX_TILE_HEIGHT
| Upper bound of maximum allowed heightlevel (in the construction settings)
static constexpr uint | MIN_SNOWLINE_HEIGHT = 2
| Minimum snowline height.
static constexpr uint | DEF_SNOWLINE_HEIGHT = 10
| Default snowline height.
static constexpr uint | MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2)
| Maximum allowed snowline height.
static constexpr uint | DEF_SNOW_COVERAGE = 40
| Default snow coverage.
static constexpr uint | DEF_DESERT_COVERAGE = 50
| Default desert coverage.
constexpr TileIndex | INVALID_TILE = TileIndex{ (uint32_t)-1 }
| The very nice invalid tile marker.

## Detailed Description

Types related to tiles.

Definition in file tile_type.h.

## Typedef Documentation

## ◆ TileIndex

using TileIndex = StrongType::Typedef<uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int32_t>, StrongType::Compatible<int64_t> >

The index/ID of a Tile.

It is compatible with int32 / int64 for easy math throughout the code.

Definition at line 87 of file tile_type.h.

## Enumeration Type Documentation

## ◆ TileType

enum TileType : uint8_t

The different types of tiles.

Each tile belongs to one type, according whatever is build on it.

Note
  A railway with a crossing street is marked as MP_ROAD.

Enumerator
MP_CLEAR | A tile without any structures, i.e. grass, rocks, farm fields etc.
MP_RAILWAY | A railway.
MP_ROAD | A tile with road (or tram tracks)
MP_HOUSE | A house by a town.
MP_TREES | Tile got trees.
MP_STATION | A tile of a station.
MP_WATER | Water tile.
MP_VOID | Invisible tiles at the SW and SE border.
MP_INDUSTRY | Part of an industry.
MP_TUNNELBRIDGE | Tunnel entry/exit and bridge heads.
MP_OBJECT | Contains objects such as transmitters and owned land.

Definition at line 47 of file tile_type.h.

## ◆ TropicZone

enum TropicZone : uint8_t

Additional infos of a tile on a tropic game.

The tropiczone is not modified during gameplay. It mainly affects tree growth. (desert tiles are visible though)

In randomly generated maps: TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile. TROPICZONE_RAINFOREST: Generated everywhere, if there is no desert in a certain distance from the tile. TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water).

In scenarios: TROPICZONE_NORMAL: Default value. TROPICZONE_DESERT: Placed manually. TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees.

Enumerator
TROPICZONE_NORMAL | Normal tropiczone.
TROPICZONE_DESERT | Tile is desert.
TROPICZONE_RAINFOREST | Rainforest tile.

Definition at line 76 of file tile_type.h.

## Variable Documentation

## ◆ DEF_DESERT_COVERAGE

constexpr uint DEF_DESERT_COVERAGE = 50
| staticconstexpr

Default desert coverage.

Definition at line 37 of file tile_type.h.

Referenced by GenerateLandscapeWindow::OnQueryTextFinished().

## ◆ DEF_SNOW_COVERAGE

constexpr uint DEF_SNOW_COVERAGE = 40
| staticconstexpr

Default snow coverage.

Definition at line 36 of file tile_type.h.

Referenced by GenerateLandscapeWindow::OnQueryTextFinished().

## ◆ DEF_SNOWLINE_HEIGHT

constexpr uint DEF_SNOWLINE_HEIGHT = 10
| staticconstexpr

Default snowline height.

Definition at line 33 of file tile_type.h.

Referenced by _GenerateWorld().

## ◆ INVALID_TILE

constexpr TileIndex INVALID_TILE = TileIndex{ (uint32_t)-1 }
| inlineconstexpr

The very nice invalid tile marker.

Definition at line 95 of file tile_type.h.

Referenced by OrthogonalTileArea::Add(), AddAcceptedCargoOfHouse(), AddTileIndexDiffCWrap(), CargoPacket::AfterLoad(), AfterLoadGame(), AircraftController(), AircraftGetEntryPoint(), AirportGetNearestTown(), CalcClosestStationTile(), Station::CatchmentCoversTown(), CheckFlatLandAirport(), CheckSubsidised(), OrthogonalTileArea::Clear(), DiagonalTileArea::Clear(), ErrmsgWindow::Close(), CmdBuildAirport(), CmdBuildCanal(), CmdBuildObject(), CmdBuildObjectArea(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoadStop(), CmdBuildTunnel(), CmdClearArea(), CmdClearOrderBackup(), CmdConvertRail(), CmdConvertRoad(), CmdLevelLand(), CmdPlantTree(), CmdRemoveFromRailStation(), CmdRemoveRoadStop(), CmdSignalTrackHelper(), CmdTerraformLand(), CountMapSquareAround(), Train::Crash(), CreateRandomTown(), DeallocateSpecFromStation(), DetermineNextTrainForceProceeding(), Disaster_Zeppeliner_Init(), DisasterTick_Big_Ufo_Destroyer(), DoCreateNewIndustry(), DoTrainPathfind(), DrawNewHouseTileInGUI(), DrawNewObjectTileInGUI(), DrawRoadDepotSprite(), DrawRoadStopTile(), DrawStationTile(), BuildIndustryWindow::DrawWidget(), BuildObjectWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), ExploreSegment(), FindDockLandPart(), FindNearestGoodCoastalTownSpot(), FindNearestHangar(), FindSpring(), GetAcceptanceAroundStation(), GetAcceptedCargoOfHouse(), GetAirportTextCallback(), GetCargoSuffix(), Station::GetCatchmentRadius(), CargoPacket::GetDistance(), GetHouseName(), GetIndustryProbabilityCallback(), Order::GetLocation(), GetOrderDistance(), Vehicle::GetOrderStationLocation(), GetProducedCargoOfHouse(), AirportTileScopeResolver::GetRandomBits(), RoadStopScopeResolver::GetRandomBits(), StationScopeResolver::GetRandomBits(), GetReferenceTile(), GetSlopePixelZOutsideMap(), Airport::GetSpec(), StationFinder::GetStations(), GetTargetAirportIfValid(), SmallMapWindow::GetTileColours(), AirportResolverObject::GetTown(), IndustriesResolverObject::GetTown(), StationResolverObject::GetTown(), HouseScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), RailTypeScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), RoadTypeScopeResolver::GetVariable(), StationScopeResolver::GetVariable(), HouseResolverObject::HouseResolverObject(), InitializeWindowViewport(), InvalidateWaterRegion(), IsRoadStopAvailable(), IsStationAvailable(), ROADChunkHandler::Load(), Station::MarkTilesDirty(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), VehicleGroupWindow::OnClick(), NewsWindow::OnClick(), OrdersWindow::OnClick(), VehicleListWindow::OnClick(), VehicleViewWindow::OnClick(), Train::OnNewEconomyDay(), CompanyWindow::OnPaint(), VehicleViewWindow::OnPaint(), BitmapTileIterator::operator++(), AirportTileTableIterator::operator++(), AirportTileIterator::operator++(), OrthogonalTileIterator::operator++(), DiagonalTileIterator::operator++(), CYapfCostRailT< Types >::PfCalcCost(), PlaceTreeAtSameHeight(), PlaceTreeGroupAroundTile(), PlaceTreeGroups(), ProcessOrders(), Station::RecomputeCatchment(), RemoveDock(), RemoveFromRailBaseStation(), RemoveRoadWaypointStop(), BitmapTileArea::Reset(), OrderBackup::Reset(), OrderBackup::ResetOfUser(), ReverseTrainDirection(), CYapfOriginTileTwoWayT< Types >::SetOrigin(), SetRedErrorSquare(), ShowExtraViewportWindowForTileUnderCursor(), TerraformTileHeight(), TileAddWrap(), TileLoop_Water(), TownActionBuildStatue(), TrainApproachingCrossingTile(), TrainController(), TriggerWatchedCargoCallbacks(), CYapfReserveTrack< Types >::TryReservePath(), UpdateAirplanesOnNewStation(), UpdateAirportsNoise(), UpdateCompanyHQ(), CargoPacket::UpdateLoadingTile(), UpdateSignalsAroundSegment(), UpdateSignalsInBuffer(), and ViewportAddLandscape().

## ◆ MAX_BUILDING_PIXELS

constexpr uint MAX_BUILDING_PIXELS = 200
| staticconstexpr

Maximum height of a building in pixels in ZOOM_BASE. (Also applies to "bridge buildings" on the bridge floor.)

Definition at line 20 of file tile_type.h.

## ◆ MAX_MAP_HEIGHT_LIMIT

constexpr uint MAX_MAP_HEIGHT_LIMIT = MAX_TILE_HEIGHT
| staticconstexpr

Upper bound of maximum allowed heightlevel (in the construction settings)

Definition at line 30 of file tile_type.h.

Referenced by ClickChangeMaxHlCheat(), GenerateWorld(), GetMapHeightLimit(), and GenerateLandscapeWindow::UpdateWidgetSize().

## ◆ MAX_SNOWLINE_HEIGHT

constexpr uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2)
| staticconstexpr

Maximum allowed snowline height.

Definition at line 34 of file tile_type.h.

## ◆ MAX_TILE_HEIGHT

constexpr uint MAX_TILE_HEIGHT = 255
| staticconstexpr

Maximum allowed tile height.

Definition at line 24 of file tile_type.h.

Referenced by BuildLandLegend(), CalculateCoverageLine(), CommonRaiseLowerBigLand(), FixSlopes(), SetTileHeight(), GenerateLandscapeWindow::UpdateWidgetSize(), and CreateScenarioWindow::UpdateWidgetSize().

## ◆ MAX_VEHICLE_PIXEL_X

constexpr int MAX_VEHICLE_PIXEL_X = 192
| staticconstexpr

Maximum width of a vehicle in pixels in ZOOM_BASE.

Definition at line 21 of file tile_type.h.

Referenced by CheckClickOnVehicle(), and ViewportAddVehicles().

## ◆ MAX_VEHICLE_PIXEL_Y

constexpr int MAX_VEHICLE_PIXEL_Y = 96
| staticconstexpr

Maximum height of a vehicle in pixels in ZOOM_BASE.

Definition at line 22 of file tile_type.h.

Referenced by CheckClickOnVehicle(), and ViewportAddVehicles().

## ◆ MIN_CUSTOM_TERRAIN_TYPE

constexpr uint MIN_CUSTOM_TERRAIN_TYPE = 1
| staticconstexpr

Lowest possible peak value for world generation.

Definition at line 27 of file tile_type.h.

Referenced by GenerateLandscapeWindow::OnQueryTextFinished().

## ◆ MIN_HEIGHTMAP_HEIGHT

constexpr uint MIN_HEIGHTMAP_HEIGHT = 1
| staticconstexpr

Lowest possible peak value for heightmap creation.

Definition at line 26 of file tile_type.h.

Referenced by GenerateLandscapeWindow::OnClick(), GenerateLandscapeWindow::OnInvalidateData(), and GenerateLandscapeWindow::OnQueryTextFinished().

## ◆ MIN_MAP_HEIGHT_LIMIT

constexpr uint MIN_MAP_HEIGHT_LIMIT = 15
| staticconstexpr

Lower bound of maximum allowed heightlevel (in the construction settings)

Definition at line 29 of file tile_type.h.

Referenced by ClickChangeMaxHlCheat(), and GenerateLandscapeWindow::OnQueryTextFinished().

## ◆ MIN_SNOWLINE_HEIGHT

constexpr uint MIN_SNOWLINE_HEIGHT = 2
| staticconstexpr

Minimum snowline height.

Definition at line 32 of file tile_type.h.

Referenced by AfterLoadGame().

## ◆ TILE_HEIGHT

constexpr uint TILE_HEIGHT = 8
| staticconstexpr

Height of a height level in world coordinate AND in pixels in ZOOM_BASE.

Definition at line 18 of file tile_type.h.

Referenced by AfterLoadGame(), ApplyPixelFoundationToSlope(), DrawBridgeMiddle(), DrawBridgePillars(), DrawFoundation(), DrawPillar(), DrawPillarColumn(), DrawRoadTypeCatenary(), DrawTile_TunnelBridge(), DrawTileSelection(), DrawTileSelectionRect(), DrawTrackBits(), GetBridgePixelHeight(), GetFoundationPixelSlope(), GetGlobalVariable(), GetNearbyTileInformation(), GetPartialPixelZ(), GetPCPElevation(), GetSlopeMaxPixelZ(), GetSlopePixelZInCorner(), GetSlopePixelZOnEdge(), GetTileHeightBelowAircraft(), GetTileMaxPixelZ(), GetTilePixelSlope(), GetTilePixelSlopeOutsideMap(), GetTilePixelZ(), IndustriesScopeResolver::GetVariable(), InverseRemapCoords2(), MarkTileDirtyByTile(), CYapfCostShipT< Types >::PfCalcCost(), SetSelectionTilesDirty(), ShipTestUpDownOnLock(), SplitGroundSpriteForOverlay(), TilePixelHeight(), TilePixelHeightOutsideMap(), and ViewportAddLandscape().

## ◆ TILE_PIXELS

constexpr uint TILE_PIXELS = 32
| staticconstexpr

Pixel distance between tile columns/rows in ZOOM_BASE.

Definition at line 17 of file tile_type.h.

Referenced by ClampSmoothScroll(), DrawHouseInGUI(), GetViewportY(), InverseRemapCoords2(), and SetSelectionTilesDirty().

## ◆ TILE_SIZE

constexpr uint TILE_SIZE = 16
| staticconstexpr

Tile size in world coordinates.

Definition at line 15 of file tile_type.h.

Referenced by AfterLoadGame(), AircraftController(), AircraftGetEntryPoint(), CalcRaildirsDrawstyle(), CheckPartialPixelZSlopeAddition(), CheckTrainAttachment(), RoadStop::ClearDriveThrough(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdChangeBankBalance(), CmdClearArea(), CmdMoveSign(), CmdPlaceSign(), SmallMapWindow::ComputeScroll(), CreateEffectVehicleAbove(), Disaster_Helicopter_Init(), Disaster_Small_Ufo_Init(), Disaster_Zeppeliner_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Big_Ufo_Destroyer(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), DrawBridgeMiddle(), DrawBridgeRoadBits(), DrawFoundation(), SmallMapWindow::DrawMapIndicators(), DrawRoadTypeCatenary(), SmallMapWindow::DrawSmallMap(), DrawStationCoverageAreaText(), DrawTile_TunnelBridge(), DepotWindow::DrawVehicleInDepot(), SmallMapWindow::DrawVehicles(), FindStationsAroundSelection(), FixVehicleInclination(), Train::GetCurrentMaxSpeed(), GetPartialPixelZ(), GetPCPElevation(), RailTypeScopeResolver::GetRandomBits(), RoadTypeScopeResolver::GetRandomBits(), GetSlopePixelZOutsideMap(), GetTileHeightBelowAircraft(), GetTrainStopLocation(), HandleCrashedAircraft(), InitializeWindowViewport(), CommandHelperBase::InternalPostBefore(), CommandHelperBase::InternalPostResult(), InverseRemapCoords2(), VehiclesNearTileXY::Iterator::Iterator(), RoadStop::MakeDriveThrough(), MarkTileDirtyByTile(), SmallMapWindow::OnClick(), SmallMapWindow::OnScroll(), PlaceAirport(), RoadStop::Entry::Rebuild(), SmallMapWindow::RemapTile(), ReplaceChain(), RotateAirportMovingData(), ScrollMainWindowToTile(), ScrollWindowTo(), ScrollWindowToTile(), SetAircraftPosition(), SmallMapWindow::SetNewScroll(), SetSelectionTilesDirty(), SetTileSelectSize(), SetupScreenshotViewport(), SmallMapWindow::SetZoomLevel(), ShowBuildBridgeWindow(), SmallMapWindow::SmallMapCenterOnCurrentPos(), TrainApproachingLineEnd(), UpdateLoadUnloadTicks(), DisasterVehicle::UpdatePosition(), UpdateTileSelection(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), Waypoint::UpdateVirtCoord(), GroundVehicle< T, Type >::UpdateZPositionAndInclination(), ViewportAddLandscape(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().

## ◆ TILE_UNIT_MASK

constexpr uint TILE_UNIT_MASK = TILE_SIZE - 1
| staticconstexpr

For masking in/out the inner-tile world coordinate units.

Definition at line 16 of file tile_type.h.

Referenced by AfterLoadGame(), CalcRaildirsDrawstyle(), Check2x1AutoRail(), FixVehicleInclination(), GetAutorailHT(), UpdateTileSelection(), and GroundVehicle< T, Type >::UpdateZPositionAndInclination().