OpenTTD Source 20250426-master-gbb1d561369
|
Functions related to maps. More...
#include "core/math_func.hpp"
#include "tile_type.h"
#include "map_type.h"
#include "direction_func.h"
Go to the source code of this file.
Data Structures | |
class | Tile |
Wrapper class to abstract away the way the tiles are stored. More... | |
struct | Tile::TileBase |
Data that is stored per tile. More... | |
struct | Tile::TileExtended |
Data that is stored per tile. More... | |
struct | Map |
Size related data of the map. More... | |
struct | Map::Iterator |
Iterator to iterate all Tiles. More... | |
struct | Map::IterateWrapper |
Macros | |
#define | RandomTile() RandomTileSeed(Random()) |
Get a valid random tile. | |
Functions | |
static debug_inline TileIndex | TileXY (uint x, uint y) |
Returns the TileIndex of a coordinate. | |
TileIndexDiff | TileDiffXY (int x, int y) |
Calculates an offset for the given coordinate(-offset). | |
static debug_inline TileIndex | TileVirtXY (uint x, uint y) |
Get a tile from the virtual XY-coordinate. | |
static debug_inline uint | TileX (TileIndex tile) |
Get the X component of a tile. | |
static debug_inline uint | TileY (TileIndex tile) |
Get the Y component of a tile. | |
TileIndexDiff | ToTileIndexDiff (TileIndexDiffC tidc) |
Return the offset between two tiles from a TileIndexDiffC struct. | |
constexpr TileIndex & | operator+= (TileIndex &tile, TileIndexDiff offset) |
constexpr TileIndex & | operator-= (TileIndex &tile, TileIndexDiff offset) |
constexpr TileIndex | TileAdd (TileIndex tile, TileIndexDiff offset) |
Adds a given offset to a tile. | |
TileIndex | TileAddXY (TileIndex tile, int x, int y) |
Adds a given offset to a tile. | |
TileIndex | TileAddWrap (TileIndex tile, int addx, int addy) |
This function checks if we add addx/addy to tile, if we do wrap around the edges. | |
TileIndexDiffC | TileIndexDiffCByDiagDir (DiagDirection dir) |
Returns the TileIndexDiffC offset from a DiagDirection. | |
TileIndexDiffC | TileIndexDiffCByDir (Direction dir) |
Returns the TileIndexDiffC offset from a Direction. | |
TileIndex | AddTileIndexDiffCWrap (TileIndex tile, TileIndexDiffC diff) |
Add a TileIndexDiffC to a TileIndex and returns the new one. | |
TileIndexDiffC | TileIndexToTileIndexDiffC (TileIndex tile_a, TileIndex tile_b) |
Returns the diff between two tiles. | |
uint | DistanceManhattan (TileIndex, TileIndex) |
also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads) | |
uint | DistanceSquare (TileIndex, TileIndex) |
Euclidean- or L2-Norm squared. | |
uint | DistanceMax (TileIndex, TileIndex) |
also known as L-Infinity-Norm | |
uint | DistanceMaxPlusManhattan (TileIndex, TileIndex) |
Max + Manhattan. | |
uint | DistanceFromEdge (TileIndex) |
shortest distance from any edge of the map | |
uint | DistanceFromEdgeDir (TileIndex, DiagDirection) |
distance from the map edge in given direction | |
TileIndexDiff | TileOffsByAxis (Axis axis) |
Convert an Axis to a TileIndexDiff. | |
TileIndexDiff | TileOffsByDiagDir (DiagDirection dir) |
Convert a DiagDirection to a TileIndexDiff. | |
TileIndexDiff | TileOffsByDir (Direction dir) |
Convert a Direction to a TileIndexDiff. | |
TileIndex | TileAddByDir (TileIndex tile, Direction dir) |
Adds a Direction to a tile. | |
TileIndex | TileAddByDiagDir (TileIndex tile, DiagDirection dir) |
Adds a DiagDir to a tile. | |
DiagDirection | DiagdirBetweenTiles (TileIndex tile_from, TileIndex tile_to) |
Determines the DiagDirection to get from one tile to another. | |
TileIndex | RandomTileSeed (uint32_t r) |
Get a random tile out of a given seed. | |
uint | GetClosestWaterDistance (TileIndex tile, bool water) |
Finds the distance for the closest tile with water/land given a tile. | |
Functions related to maps.
Definition in file map_func.h.
#define RandomTile | ( | ) | RandomTileSeed(Random()) |
Get a valid random tile.
Definition at line 651 of file map_func.h.
|
inline |
Add a TileIndexDiffC to a TileIndex and returns the new one.
Returns tile + the diff given in diff. If the result tile would end up outside of the map, INVALID_TILE is returned instead.
tile | The base tile to add the offset on |
diff | The offset to add on the tile |
Definition at line 514 of file map_func.h.
References INVALID_TILE, Map::SizeX(), Map::SizeY(), TileX(), TileXY(), TileY(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by CalculateCoverageLine(), InvalidateWaterRegion(), TerraformTileHeight(), and TileLoop_Water().
|
inline |
Determines the DiagDirection to get from one tile to another.
The tiles do not necessarily have to be adjacent.
tile_from | Origin tile |
tile_to | Destination tile |
Definition at line 622 of file map_func.h.
References DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, INVALID_DIAGDIR, TileX(), and TileY().
Referenced by WaterRegion::ForceUpdate(), and TrainController().
uint DistanceFromEdge | ( | TileIndex | tile | ) |
shortest distance from any edge of the map
shortest distance from any edge of the map
tile | the tile to get the distance from |
Definition at line 202 of file map.cpp.
References Map::SizeX(), Map::SizeY(), TileX(), and TileY().
Referenced by GenerateStationName(), GrayscaleToMapHeights(), GrowTownWithExtraHouse(), IsRoadAllowedHere(), and TownCanBePlacedHere().
uint DistanceFromEdgeDir | ( | TileIndex | tile, |
DiagDirection | dir | ||
) |
distance from the map edge in given direction
distance from the map edge in given direction
tile | the tile to get the distance from |
dir | the direction of interest |
Definition at line 219 of file map.cpp.
References _settings_game, GameSettings::construction, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, ConstructionSettings::freeform_edges, Map::MaxX(), Map::MaxY(), TileX(), and TileY().
Referenced by CheckScaledDistanceFromEdge(), and GetOtherAqueductEnd().
also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
The Manhattan distance is the sum of the delta of both the X and Y component. Also known as L1-Norm
t0 | the start tile |
t1 | the end tile |
Definition at line 142 of file map.cpp.
References Delta(), TileX(), and TileY().
Referenced by AfterLoadGame(), AirportGetNearestTown(), CalcClosestTownFromTile(), CalcRaildirsDrawstyle(), RiverBuilder::CalculateH(), CheckSubsidyDistance(), ClosestTownFromTile(), DeleteStaleLinks(), FindDeletedWaypointCloseTo(), FindSubsidyPassengerRoute(), FlowRiver(), FlowsDown(), WaterRegion::ForceUpdate(), RiverBuilder::FoundEndNode(), GetClosestObject(), GetCountAndDistanceOfClosestInstance(), CargoPacket::GetDistance(), GetDistanceFromNearbyHouse(), GetOrderDistance(), IndustriesScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), HighlightTownLocalAuthorityTiles(), IsCloseToTown(), LinkRefresher::RefreshStats(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and YapfTrainCheckReverse().
also known as L-Infinity-Norm
also known as L-Infinity-Norm
Also known as L-Infinity-Norm.
t0 | the start tile |
t1 | the end tile |
Definition at line 174 of file map.cpp.
References Delta(), TileX(), and TileY().
Referenced by Station::AddIndustryToDeliver(), CheckIfFarEnoughFromConflictingIndustry(), CheckIfIndustryIsAllowed(), FindStationsNearby(), and GenerateStationName().
Max + Manhattan.
Max + Manhattan.
two times the biggest distance component and once the smallest component.
t0 | the start tile |
t1 | the end tile |
Definition at line 190 of file map.cpp.
References Delta(), TileX(), and TileY().
Referenced by DemandCalculator::CalcDemand(), and MultiCommodityFlow::Dijkstra().
Euclidean- or L2-Norm squared.
Euclidean- or L2-Norm squared.
The 'Square' distance is the square of the shortest (straight line) distance between the two tiles. Also known as Euclidean- or L2-Norm squared.
t0 | the start tile |
t1 | the end tile |
Definition at line 159 of file map.cpp.
References TileX(), and TileY().
Referenced by CmdBuildBridge(), CmdBuildRoad(), CmdBuildTunnel(), FindNearestHangar(), GetOrderDistance(), GetTownRadiusGroup(), IndustriesScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), and PlaceTreeGroupAroundTile().
uint GetClosestWaterDistance | ( | TileIndex | tile, |
bool | water | ||
) |
Finds the distance for the closest tile with water/land given a tile.
tile | the tile to find the distance too |
water | whether to find water or land |
Definition at line 236 of file map.cpp.
References _settings_game, GameSettings::construction, DIAGDIR_BEGIN, DIAGDIR_END, ConstructionSettings::freeform_edges, HasTileWaterGround(), IsInsideMM(), IsTileType(), Map::Iterate(), Map::MaxX(), Map::MaxY(), MP_VOID, MP_WATER, TileX(), TileXY(), and TileY().
Referenced by FindNearestGoodCoastalTownSpot(), and IndustriesScopeResolver::GetVariable().
|
constexpr |
Definition at line 445 of file map_func.h.
|
constexpr |
Definition at line 446 of file map_func.h.
|
inline |
Get a random tile out of a given seed.
r | the random 'seed' |
Definition at line 640 of file map_func.h.
References Map::WrapToMap().
Referenced by PlaceTreesRandomly(), and PlantRandomTree().
|
constexpr |
Adds a given offset to a tile.
tile | The tile to add an offset to. |
offset | The offset to add. |
Definition at line 456 of file map_func.h.
Referenced by CalcHeightdiff(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), FindRailStationEnd(), GetOtherAqueductEnd(), GrowTown(), IsNeighbourRoadTile(), CYapfReserveTrack< Types >::ReserveRailStationPlatform(), SetRailStationPlatformReservation(), TileAddByDiagDir(), TileAddByDir(), TileAddXY(), and CYapfReserveTrack< Types >::UnreserveSingleTrack().
|
inline |
Adds a DiagDir to a tile.
tile | The current tile |
dir | The direction in which we want to step |
Definition at line 610 of file map_func.h.
References TileAdd(), and TileOffsByDiagDir().
Referenced by CleanUpRoadBits(), ClearPathReservation(), CmdPlaceHouse(), CmdRemoveSingleSignal(), DrawRoadTypeCatenary(), DrawTile_Road(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), GrowTownAtRoad(), GrowTownInTile(), GrowTownWithBridge(), GrowTownWithExtraHouse(), GrowTownWithTunnel(), MarkDirtyAdjacentLevelCrossingTiles(), MaskWireBits(), BuildDocksToolbarWindow::OnPlaceObject(), BuildDocksToolbarWindow::OnPlacePresize(), RiverMakeWider(), SetWaterClassDependingOnSurroundings(), TrainController(), TryPathReserve(), and UpdateLevelCrossing().
Adds a Direction to a tile.
tile | The current tile |
dir | The direction in which we want to step |
Definition at line 598 of file map_func.h.
References TileAdd(), and TileOffsByDir().
Referenced by CalcHeightdiff(), FindStationsNearby(), and GrowTownInTile().
This function checks if we add addx/addy to tile, if we do wrap around the edges.
For example, tile = (10,2) and addx = +3 and addy = -4. This function will now return INVALID_TILE, because the y is wrapped. This is needed in for example, farmland. When the tile is not wrapped, the result will be tile + TileDiffXY(addx, addy)
tile | the 'starting' point of the adding |
addx | the amount of tiles in the X direction to add |
addy | the amount of tiles in the Y direction to add |
Definition at line 93 of file map.cpp.
References _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, INVALID_TILE, Map::MaxX(), Map::MaxY(), TileX(), TileXY(), and TileY().
Referenced by CheckIfIndustryTilesAreFree(), CheckIfIndustryTileSlopes(), CmdBuildRoadStop(), CmdRemoveRoadStop(), CountMapSquareAround(), DisasterTick_Big_Ufo_Destroyer(), FindSpring(), PlaceTreeAtSameHeight(), PlaceTreeGroupAroundTile(), and PlaceTreeGroups().
Adds a given offset to a tile.
tile | The tile to add an offset to. |
x | The x offset to add to the tile. |
y | The y offset to add to the tile. |
Definition at line 469 of file map_func.h.
References TileAdd(), and TileDiffXY().
Referenced by AdvanceHouseConstruction(), AfterLoadGame(), CheckAllowRemoveRoad(), CheckNewIndustry_OilRefinery(), CheckNewIndustry_OilRig(), CmdPlaceHouse(), DrawWaterEdges(), FindStationsNearby(), OrthogonalTileArea::GetCenterTile(), GetOtherAqueductEnd(), CanalScopeResolver::GetVariable(), HeightmapCallback(), TileLoop_Town(), and TriggerHouseAnimation_WatchedCargoAccepted().
|
inline |
Calculates an offset for the given coordinate(-offset).
This function calculate an offset value which can be added to a TileIndex. The coordinates can be negative.
x | The offset in x direction |
y | The offset in y direction |
Definition at line 388 of file map_func.h.
References Map::SizeX().
Referenced by AfterLoadGame(), ChangeIndustryProduction(), CheckIfCanLevelIndustryPlatform(), ClearTownHouse(), CmdTerraformLand(), Disaster_CoalMine_Init(), GetHouseNorthPart(), GetNearbyTile(), GetReferenceTile(), Airport::GetRotatedTileFromOffset(), HouseScopeResolver::GetVariable(), GUIPlaceProcDragXY(), MakeTownHouse(), BuildObjectWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), OrthogonalTileIterator::operator++(), RebuildTownCaches(), RemoveNearbyStations(), TerraformAddDirtyTileAround(), TileAddXY(), ToTileIndexDiff(), and UpdateHousesAndTowns().
|
inline |
Returns the TileIndexDiffC offset from a DiagDirection.
dir | The given direction |
Definition at line 482 of file map_func.h.
References _tileoffs_by_diagdir, DIAGDIR_END, and IsValidDiagDirection().
Referenced by CalculateCoverageLine(), SpiralTileIterator::Increment(), InvalidateWaterRegion(), TerraformTileHeight(), and VisitAdjacentWaterRegionPatchNeighbours().
|
inline |
Returns the TileIndexDiffC offset from a Direction.
dir | The given direction |
Definition at line 496 of file map_func.h.
References _tileoffs_by_dir, DIR_END, and IsValidDirection().
Referenced by SpiralTileIterator::Increment(), and TileLoop_Water().
|
inline |
Returns the diff between two tiles.
tile_a | from tile |
tile_b | to tile |
Definition at line 530 of file map_func.h.
References TileX(), TileY(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by DoTriggerHouseAnimation_WatchedCargoAccepted(), GetTownRoadGridElement(), TileLoop_Town(), TownLayoutAllows2x2HouseHere(), and TownLayoutAllowsHouseHere().
|
inline |
Convert an Axis to a TileIndexDiff.
axis | The Axis |
Definition at line 554 of file map_func.h.
References _tileoffs_by_axis, IsValidAxis(), and ToTileIndexDiff().
Referenced by RoadStop::Entry::CheckIntegrity(), RoadStop::ClearDriveThrough(), CmdBuildBridge(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoadWaypoint(), CmdBuildShipDepot(), CmdRemoveLongRoad(), GetOtherShipDepotTile(), Station::GetPlatformLength(), RoadStop::MakeDriveThrough(), RoadStop::Entry::Rebuild(), and SetupFarmFieldFence().
|
inline |
Convert a DiagDirection to a TileIndexDiff.
dir | The DiagDirection |
Definition at line 569 of file map_func.h.
References _tileoffs_by_diagdir, DIAGDIR_END, IsValidDiagDirection(), and ToTileIndexDiff().
Referenced by CanConnectToRoad(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CanFollowRoad(), CanRoadContinueIntoNextTile(), CheckForDockingTile(), CheckFree2x2Area(), CheckTownBuild2House(), CheckTownBuild2x2House(), ClearDockingTilesCheckingNeighbours(), CmdBuildDock(), CmdBuildLongRoad(), CmdBuildRailStation(), CmdBuildTunnel(), ConnectRoadToStructure(), Disaster_CoalMine_Init(), DisasterTick_Submarine(), DoBuildLock(), DoClearBridge(), DrawRailCatenaryRailway(), DrawTile_TunnelBridge(), ExploreSegment(), ExtendTrainReservation(), FindDockLandPart(), FixOwnerOfRailTrack(), FlowRiver(), FollowReservation(), FollowTrainReservation(), GetBridgeEnd(), RiverBuilder::GetNeighbours(), GetOtherAqueductEnd(), GetOtherTunnelEnd(), Station::GetPlatformLength(), GetTrainForReservation(), GrowTownWithBridge(), GrowTownWithTunnel(), CYapfCostRailT< Types >::IsAnyStationTileReserved(), IsNeighbourRoadTile(), IsShipDestinationTile(), IsTunnelInWayDir(), MakeDock(), MakeLake(), MakeLock(), MarkBridgeDirty(), NeighbourIsNormal(), CYapfCostRoadT< Types >::OneTileCost(), RemoveDock(), RemoveLock(), CYapfReserveTrack< Types >::ReserveRailStationPlatform(), SetRailStationPlatformReservation(), SetupFarmFieldFence(), TestTownOwnsBridge(), TileAddByDiagDir(), TrainApproachingCrossing(), TrainApproachingCrossingTile(), TrainCheckIfLineEnds(), TryBuildLightHouse(), CYapfReserveTrack< Types >::UnreserveSingleTrack(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), and UpdateSignalsInBuffer().
|
inline |
Convert a Direction to a TileIndexDiff.
dir | The direction to convert from |
Definition at line 583 of file map_func.h.
References _tileoffs_by_dir, DIR_END, IsValidDirection(), and ToTileIndexDiff().
Referenced by ClearNeighbourNonFloodingStates(), IsWateredTile(), MarkCanalsAndRiversAroundDirty(), and TileAddByDir().
|
static |
Get a tile from the virtual XY-coordinate.
x | The virtual x coordinate of the tile. |
y | The virtual y coordinate of the tile. |
Definition at line 403 of file map_func.h.
References Map::LogX().
Referenced by AfterLoadGame(), AircraftController(), AircraftLandAirplane(), CalcRaildirsDrawstyle(), CheckGroundVehiclesAtCorrectZ(), CheckTrainCollision(), CrashAirplane(), DisasterTick_Aircraft(), DisasterVehicle::DisasterVehicle(), DrawStationCoverageAreaText(), DrawTileSelection(), FindNearestHangar(), FindStationsAroundSelection(), GetNewVehiclePos(), GetSlopePixelZ(), GetTileHeightBelowAircraft(), HandleAutoSignalPlacement(), SignListWindow::OnClick(), SignWindow::OnClick(), VehicleViewWindow::OnClick(), BuildRailToolbarWindow::OnHotkey(), BuildRoadToolbarWindow::OnHotkey(), BuildTreesWindow::OnPlaceDrag(), RemoveRoad(), SetSelectionTilesDirty(), ShowExtraViewportWindowForTileUnderCursor(), DisasterVehicle::UpdatePosition(), UpdateStatusAfterSwap(), VpHandlePlaceSizingDrag(), VpSelectTilesWithMethod(), and YapfTrainCheckReverse().
|
static |
Get the X component of a tile.
tile | the tile to get the X component of |
Definition at line 414 of file map_func.h.
References Map::MaxX().
Referenced by OrthogonalTileArea::Add(), AyStar::AddStartNode(), AddTileIndexDiffCWrap(), CargoPacket::AfterLoad(), AfterLoadGame(), AircraftController(), AircraftGetEntryPoint(), AirportGetNearestTown(), AlignTileToGrid(), CalcClosestStationTile(), CalcClosestTownFromTile(), CalcHeightdiff(), CanExpandRailStation(), CcBuildIndustry(), CheckIfCanLevelIndustryPlatform(), OrthogonalTileArea::ClampToMap(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildLongRoad(), CmdBuildObject(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdBuildTunnel(), CmdChangeBankBalance(), CmdClearArea(), CmdPlaceSign(), CmdRemoveLongRoad(), OrthogonalTileArea::Contains(), DiagonalTileArea::Contains(), DiagdirBetweenTiles(), DiagonalTileArea::DiagonalTileArea(), Disaster_Small_Ufo_Init(), Disaster_Zeppeliner_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Ufo(), DistanceFromEdge(), DistanceFromEdgeDir(), DistanceManhattan(), DistanceMax(), DistanceMaxPlusManhattan(), DistanceSquare(), SmallMapWindow::DrawIndustryNames(), DrawTileSelection(), SmallMapWindow::DrawTowns(), OrthogonalTileArea::Expand(), FindStationsAroundSelection(), FindStationsNearby(), ForAllStationsRadius(), WaterRegion::ForceUpdate(), GenerateStationName(), GetClosestWaterDistance(), CargoPacket::GetDistance(), WaterRegion::GetLocalIndex(), GetOtherAqueductEnd(), GetPCPElevation(), RailTypeScopeResolver::GetRandomBits(), RoadTypeScopeResolver::GetRandomBits(), GetRelativePosition(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GetTLG(), GetTunnelBridgeLength(), HouseScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), GUIPlaceProcDragXY(), HighlightTownLocalAuthorityTiles(), Town::InitializeLayout(), InitializeWindowViewport(), CommandHelperBase::InternalPostBefore(), CommandHelperBase::InternalPostResult(), OrthogonalTileArea::Intersects(), IsCloseToTown(), IsInnerTile(), IsTileAlignedToGrid(), IsTileFlat(), IsTunnelInWay(), AirportSpec::IsWithinMapBounds(), VehiclesOnTile::Iterator::Iterator(), MarkTileDirtyByTile(), LandInfoWindow::OnInit(), BuildObjectWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), OrthogonalTileArea::OrthogonalTileArea(), PerformStationTileSlopeCheck(), CYapfDestinationTileOrStationRailT< Types >::PfCalcEstimate(), CYapfDestinationTileRoadT< Types >::PfCalcEstimate(), CYapfDestinationTileWaterT< Types >::PfCalcEstimate(), ScrollMainWindowToTile(), ScrollWindowToTile(), SetupScreenshotViewport(), SetWaterClassDependingOnSurroundings(), ShowBuildBridgeWindow(), SpiralTileIterator::SpiralTileIterator(), SwapDirection(), TerraformAddDirtyTileAround(), TerraformTileHeight(), TileAddWrap(), TileIndexToTileIndexDiffC(), TileStr(), CargoPacket::UpdateLoadingTile(), CargoPacket::UpdateUnloadingTile(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), Waypoint::UpdateVirtCoord(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().
|
static |
Returns the TileIndex of a coordinate.
x | The x coordinate of the tile |
y | The y coordinate of the tile |
Definition at line 372 of file map_func.h.
References Map::LogX().
Referenced by _GenerateWorld(), OrthogonalTileArea::Add(), AddTileIndexDiffCWrap(), AfterLoadGame(), AlignTileToGrid(), CalcClosestStationTile(), CanExpandRailStation(), ConScrollToTile(), Disaster_Small_Ufo_Init(), SmallMapWindow::DrawSmallMapColumn(), OrthogonalTileArea::Expand(), FindStationsAroundSelection(), FixSlopes(), FlatEmptyWorld(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateWorld(), GetClosestWaterDistance(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GetWaterRegionCenterTile(), GrayscaleToMapHeights(), HeightmapCallback(), BitmapTileArea::Initialize(), IsTileFlat(), LoadTownData(), DiagonalTileIterator::operator++(), OrthogonalTileArea::OrthogonalTileArea(), Station::RecomputeCatchment(), StationRect::ScanForStationTiles(), SetSelectionTilesDirty(), SetupScreenshotViewport(), TerraformTileHeight(), TileAddWrap(), TileHeightOutsideMap(), TryBuildLightHouse(), and ViewportAddLandscape().
|
static |
Get the Y component of a tile.
tile | the tile to get the Y component of |
Definition at line 424 of file map_func.h.
References Map::LogX().
Referenced by OrthogonalTileArea::Add(), AyStar::AddStartNode(), AddTileIndexDiffCWrap(), CargoPacket::AfterLoad(), AfterLoadGame(), AircraftController(), AircraftGetEntryPoint(), AirportGetNearestTown(), AlignTileToGrid(), CalcClosestStationTile(), CalcClosestTownFromTile(), CanExpandRailStation(), CcBuildIndustry(), CheckIfCanLevelIndustryPlatform(), OrthogonalTileArea::ClampToMap(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildLongRoad(), CmdBuildObject(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdBuildTunnel(), CmdChangeBankBalance(), CmdClearArea(), CmdPlaceSign(), CmdRemoveLongRoad(), OrthogonalTileArea::Contains(), DiagonalTileArea::Contains(), DiagdirBetweenTiles(), DiagonalTileArea::DiagonalTileArea(), Disaster_Helicopter_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Ufo(), DistanceFromEdge(), DistanceFromEdgeDir(), DistanceManhattan(), DistanceMax(), DistanceMaxPlusManhattan(), DistanceSquare(), SmallMapWindow::DrawIndustryNames(), DrawTileSelection(), SmallMapWindow::DrawTowns(), OrthogonalTileArea::Expand(), FindStationsAroundSelection(), FindStationsNearby(), ForAllStationsRadius(), WaterRegion::ForceUpdate(), GenerateStationName(), GetClosestWaterDistance(), CargoPacket::GetDistance(), WaterRegion::GetLocalIndex(), GetOtherAqueductEnd(), GetPCPElevation(), RailTypeScopeResolver::GetRandomBits(), RoadTypeScopeResolver::GetRandomBits(), GetRelativePosition(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GetTLG(), GetTunnelBridgeLength(), HouseScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), GUIPlaceProcDragXY(), HighlightTownLocalAuthorityTiles(), Town::InitializeLayout(), InitializeWindowViewport(), CommandHelperBase::InternalPostBefore(), CommandHelperBase::InternalPostResult(), OrthogonalTileArea::Intersects(), IsCloseToTown(), IsInnerTile(), IsTileAlignedToGrid(), IsTileFlat(), IsTunnelInWay(), AirportSpec::IsWithinMapBounds(), VehiclesOnTile::Iterator::Iterator(), MarkTileDirtyByTile(), LandInfoWindow::OnInit(), BuildObjectWindow::OnPlaceMouseUp(), TerraformToolbarWindow::OnPlaceMouseUp(), OrthogonalTileArea::OrthogonalTileArea(), PerformStationTileSlopeCheck(), CYapfDestinationTileOrStationRailT< Types >::PfCalcEstimate(), CYapfDestinationTileRoadT< Types >::PfCalcEstimate(), CYapfDestinationTileWaterT< Types >::PfCalcEstimate(), ScrollMainWindowToTile(), ScrollWindowToTile(), SetupScreenshotViewport(), SetWaterClassDependingOnSurroundings(), ShowBuildBridgeWindow(), SpiralTileIterator::SpiralTileIterator(), SwapDirection(), TerraformAddDirtyTileAround(), TerraformTileHeight(), TileAddWrap(), TileIndexToTileIndexDiffC(), TileStr(), CargoPacket::UpdateLoadingTile(), CargoPacket::UpdateUnloadingTile(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), Waypoint::UpdateVirtCoord(), VpSelectTilesWithMethod(), VpSetPresizeRange(), and VpStartPlaceSizing().
|
inline |
Return the offset between two tiles from a TileIndexDiffC struct.
This function works like TileDiffXY(int, int) and returns the difference between two tiles.
tidc | The coordinate of the offset as TileIndexDiffC |
Definition at line 439 of file map_func.h.
References TileDiffXY(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by CalcHeightdiff(), CmdBuildDock(), CmdRailTrackHelper(), CmdSignalTrackHelper(), DoCreateNewIndustry(), Airport::GetRotatedTileFromOffset(), GrowTown(), AirportTileTableIterator::operator++(), RoadTypesAllowHouseHere(), TileOffsByAxis(), TileOffsByDiagDir(), and TileOffsByDir().