|
OpenTTD Source 20260218-master-g2123fca5ea
|
Size related data of the map. More...
#include <map_func.h>
Data Structures | |
| struct | Iterator |
| Iterator to iterate all Tiles. More... | |
| struct | IterateWrapper |
Static Public Member Functions | |
| static void | Allocate (uint size_x, uint size_y) |
| (Re)allocates a map with the given dimension | |
| static void | CountLandTiles () |
| static uint | LogX () |
| Logarithm of the map size along the X side. | |
| static uint | LogY () |
| Logarithm of the map size along the y side. | |
| static uint | SizeX () |
| Get the size of the map along the X. | |
| static uint | SizeY () |
| Get the size of the map along the Y. | |
| static uint | Size () |
| Get the size of the map. | |
| static uint | MaxX () |
| Gets the maximum X coordinate within the map, including TileType::Void. | |
| static uint | MaxY () |
| Gets the maximum Y coordinate within the map, including TileType::Void. | |
| static uint | ScaleByLandProportion (uint n) |
| Scales the given value by the number of water tiles. | |
| static TileIndex | WrapToMap (TileIndex tile) |
| 'Wraps' the given "tile" so it is within the map. | |
| static uint | ScaleBySize (uint n) |
| Scales the given value by the map size, where the given value is for a 256 by 256 map. | |
| static uint | ScaleBySize1D (uint n) |
| Scales the given value by the maps circumference, where the given value is for a 256 by 256 map. | |
| static bool | IsInitialized () |
| Check whether the map has been initialized, as to not try to save the map during crashlog when the map is not there yet. | |
| static IterateWrapper | Iterate () |
| Returns an iterable ensemble of all Tiles. | |
Static Private Attributes | |
| static uint | log_x |
| 2^_map_log_x == _map_size_x | |
| static uint | log_y |
| 2^_map_log_y == _map_size_y | |
| static uint | size_x |
| Size of the map along the X. | |
| static uint | size_y |
| Size of the map along the Y. | |
| static uint | size |
| The number of tiles on the map. | |
| static uint | tile_mask |
| _map_size - 1 (to mask the mapsize) | |
| static uint | initial_land_count |
| Initial number of land tiles on the map. | |
Size related data of the map.
Definition at line 198 of file map_func.h.
|
static |
(Re)allocates a map with the given dimension
| size_x | the width of the map along the NE/SW edge |
| size_y | the 'height' of the map along the SE/NW edge |
Definition at line 37 of file map.cpp.
References AllocateWaterRegions(), Tile::base_tiles, Debug, Tile::extended_tiles, FindFirstBit(), IsInsideMM(), log_x, log_y, MAX_MAP_SIZE, MIN_MAP_SIZE, size, size_x, size_y, and tile_mask.
Referenced by MAPSChunkHandler::Load().
|
inlinestatic |
Check whether the map has been initialized, as to not try to save the map during crashlog when the map is not there yet.
Definition at line 359 of file map_func.h.
References Tile::base_tiles.
Referenced by CrashLog::WriteSavegame().
|
inlinestatic |
Returns an iterable ensemble of all Tiles.
Definition at line 368 of file map_func.h.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), CalculateCoverageLine(), ChangeOwnershipOfCompanyItems(), ClickChangeMaxHlCheat(), CmdDeleteTown(), ConvertRailTypes(), ConvertRoadTypes(), GetClosestWaterDistance(), MakeHeightmapScreenshot(), MoveWaypointsToBaseStations(), RebuildTownCaches(), SetDefaultRailGui(), UpdateHousesAndTowns(), UpdateNearestTownForRoadTiles(), and Town::~Town().
|
inlinestatic |
Logarithm of the map size along the X side.
Definition at line 245 of file map_func.h.
References log_x.
Referenced by ConReload(), ConRestart(), HeightMapGenerate(), RunTileLoop(), ScaleBySize(), ScaleBySize1D(), StartupIndustryDailyChanges(), TGPGetMaxHeight(), TileVirtXY(), TileXY(), and TileY().
|
inlinestatic |
Logarithm of the map size along the y side.
Definition at line 255 of file map_func.h.
References log_y.
Referenced by ConReload(), ConRestart(), HeightMapGenerate(), RunTileLoop(), ScaleBySize(), ScaleBySize1D(), StartupIndustryDailyChanges(), and TGPGetMaxHeight().
|
inlinestatic |
Gets the maximum X coordinate within the map, including TileType::Void.
Definition at line 291 of file map_func.h.
References SizeX().
Referenced by AfterLoadGame(), CalcRaildirsDrawstyle(), CheckIfCanLevelIndustryPlatform(), CmdBuildLock(), CmdBuildObject(), CmdBuildTunnel(), CreateEffectVehicleAbove(), DisasterTick_Aircraft(), DistanceFromEdgeDir(), SmallMapWindow::DrawSmallMapColumn(), FindStationsAroundSelection(), Station::GetCatchmentRect(), GetClosestWaterDistance(), GetTileHeightBelowAircraft(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GUIPlaceProcDragXY(), HandleCrashedAircraft(), HeightmapCallback(), InverseRemapCoords2(), IsInnerTile(), IsTileFlat(), IsTunnelInWay(), LoadTownData(), TerraformToolbarWindow::OnPlaceMouseUp(), SetAircraftPosition(), SmallMapWindow::SetNewScroll(), SetSelectionTilesDirty(), SetWaterClassDependingOnSurroundings(), TerraformTileHeight(), TileAddWrap(), TileHeightOutsideMap(), TileX(), TryBuildLightHouse(), DisasterVehicle::UpdatePosition(), and UpdateVoidTiles().
|
inlinestatic |
Gets the maximum Y coordinate within the map, including TileType::Void.
Definition at line 300 of file map_func.h.
References SizeY().
Referenced by AfterLoadGame(), CalcRaildirsDrawstyle(), CheckIfCanLevelIndustryPlatform(), CmdBuildLock(), CmdBuildObject(), CreateEffectVehicleAbove(), Disaster_Submarine_Init(), DistanceFromEdgeDir(), SmallMapWindow::DrawSmallMapColumn(), FindStationsAroundSelection(), Station::GetCatchmentRect(), GetClosestWaterDistance(), GetTileHeightBelowAircraft(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GUIPlaceProcDragXY(), HandleCrashedAircraft(), InverseRemapCoords2(), IsInnerTile(), IsTileFlat(), IsTunnelInWay(), LoadTownData(), TerraformToolbarWindow::OnPlaceMouseUp(), SetAircraftPosition(), SmallMapWindow::SetNewScroll(), SetSelectionTilesDirty(), SetWaterClassDependingOnSurroundings(), TerraformTileHeight(), TileAddWrap(), TileHeightOutsideMap(), TryBuildLightHouse(), DisasterVehicle::UpdatePosition(), and UpdateVoidTiles().
|
inlinestatic |
Scales the given value by the number of water tiles.
| n | the value to scale |
Definition at line 310 of file map_func.h.
References initial_land_count, and size.
Referenced by GenerateIndustries(), and GenerateTowns().
|
inlinestatic |
Scales the given value by the map size, where the given value is for a 256 by 256 map.
| n | the value to scale |
Definition at line 333 of file map_func.h.
References CeilDiv(), LogX(), and LogY().
Referenced by CreateRivers(), DecrementTreeCounter(), IndustryBuildData::EconomyMonthlyLoop(), GenerateLandscape(), GenerateTrees(), GetDefaultTownsForMapSize(), GetNumberOfIndustries(), GetScaledIndustryGenerationProbability(), and PlaceTreesRandomly().
|
inlinestatic |
Scales the given value by the maps circumference, where the given value is for a 256 by 256 map.
| n | the value to scale |
Definition at line 346 of file map_func.h.
References CeilDiv(), LogX(), and LogY().
Referenced by ClampSmoothScroll(), and GetScaledIndustryGenerationProbability().
|
inlinestatic |
Get the size of the map.
Definition at line 282 of file map_func.h.
References size.
Referenced by CalculateCoverageLine(), OrthogonalTileArea::ClampToMap(), CmdBuildCanal(), CmdBuildLongRoad(), CmdBuildObjectArea(), CmdClearArea(), CmdConvertRail(), CmdConvertRoad(), CmdLevelLand(), CmdPlaceHouseArea(), CmdPlantTree(), CmdRailTrackHelper(), CmdRemoveFromRailStation(), CmdRemoveFromRailWaypoint(), CmdRemoveFromRoadWaypoint(), CmdRemoveLongRoad(), CmdSignalTrackHelper(), CmdTerraformLand(), ConScrollToTile(), DiagonalTileArea::DiagonalTileArea(), CommandHelper< Tcmd, Tret(*)(DoCommandFlags, Targs...), true >::Do(), DrawStationCoverageAreaText(), DrawTile_Road(), GetTileType(), GetTropicZone(), GrowTownAtRoad(), GrowTownInTile(), IsInnerTile(), IsValidTile(), M3HIChunkHandler::Load(), M3LOChunkHandler::Load(), MAP2ChunkHandler::Load(), MAP5ChunkHandler::Load(), MAP7ChunkHandler::Load(), MAP8ChunkHandler::Load(), MAPEChunkHandler::Load(), MAPHChunkHandler::Load(), MAPOChunkHandler::Load(), MAPTChunkHandler::Load(), MarkDirtyAdjacentLevelCrossingTiles(), DiagonalTileIterator::operator++(), OrthogonalTileArea::OrthogonalTileArea(), M3HIChunkHandler::Save(), M3LOChunkHandler::Save(), MAP2ChunkHandler::Save(), MAP5ChunkHandler::Save(), MAP7ChunkHandler::Save(), MAP8ChunkHandler::Save(), MAPEChunkHandler::Save(), MAPHChunkHandler::Save(), MAPOChunkHandler::Save(), MAPTChunkHandler::Save(), SetTileHeight(), SetTileType(), SetTropicZone(), SetupScreenshotViewport(), TerraformTileHeight(), TileHeight(), TryBuildLightHouse(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), and UpdateLevelCrossing().
|
inlinestatic |
Get the size of the map along the X.
Definition at line 264 of file map_func.h.
References size_x.
Referenced by _GenerateWorld(), AddTileIndexDiffCWrap(), AllocHeightMap(), CheckScaledDistanceFromEdge(), OrthogonalTileArea::ClampToMap(), ConScrollToTile(), Disaster_Small_Ufo_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo_Destroyer(), DistanceFromEdge(), OrthogonalTileArea::Expand(), FillStaticNetworkServerGameInfo(), FixSlopes(), FlatEmptyWorld(), FlowRiver(), ForAllStationsRadius(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateWorld(), GetSlopePixelZOutsideMap(), GreyscaleToMapHeights(), IsMapSurroundedByWater(), AirportSpec::IsWithinMapBounds(), MakeHeightmapScreenshot(), MakeMinimapWorldScreenshot(), MakeScreenshotWithConfirm(), MaxX(), DiagonalTileIterator::operator++(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), MAPSChunkHandler::Save(), ScrollWindowTo(), ServerNetworkAdminSocketHandler::SendWelcome(), SetSelectionTilesDirty(), SpiralTileIterator::SkipOutsideMap(), TileDiffXY(), UpdateVoidTiles(), and ViewportAddLandscape().
|
inlinestatic |
Get the size of the map along the Y.
Definition at line 273 of file map_func.h.
References size_y.
Referenced by _GenerateWorld(), AddTileIndexDiffCWrap(), AllocHeightMap(), CheckScaledDistanceFromEdge(), OrthogonalTileArea::ClampToMap(), ConScrollToTile(), Disaster_Small_Ufo_Init(), DisasterTick_Zeppeliner(), DistanceFromEdge(), OrthogonalTileArea::Expand(), FillStaticNetworkServerGameInfo(), FixSlopes(), FlatEmptyWorld(), FlowRiver(), ForAllStationsRadius(), GenerateLandscape(), GenerateTerrainPerlin(), GenerateWorld(), GetSlopePixelZOutsideMap(), GreyscaleToMapHeights(), IsMapSurroundedByWater(), AirportSpec::IsWithinMapBounds(), MakeHeightmapScreenshot(), MakeMinimapWorldScreenshot(), MakeScreenshotWithConfirm(), MaxY(), DiagonalTileIterator::operator++(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), MAPSChunkHandler::Save(), ScrollWindowTo(), ServerNetworkAdminSocketHandler::SendWelcome(), SetSelectionTilesDirty(), SpiralTileIterator::SkipOutsideMap(), UpdateVoidTiles(), and ViewportAddLandscape().
'Wraps' the given "tile" so it is within the map.
It does this by masking the 'high' bits of.
| tile | the tile to 'wrap'. |
Definition at line 322 of file map_func.h.
References tile_mask.
Referenced by GetNearbyTile(), HouseScopeResolver::GetVariable(), RandomTileSeed(), and SetupFarmFieldFence().
|
staticprivate |
Initial number of land tiles on the map.
Definition at line 234 of file map_func.h.
Referenced by ScaleByLandProportion().
|
staticprivate |
2^_map_log_x == _map_size_x
Definition at line 227 of file map_func.h.
Referenced by Allocate(), and LogX().
|
staticprivate |
2^_map_log_y == _map_size_y
Definition at line 228 of file map_func.h.
Referenced by Allocate(), and LogY().
|
staticprivate |
The number of tiles on the map.
Definition at line 231 of file map_func.h.
Referenced by Allocate(), MultiMap< StationID, CargoPacket * >::MapSize(), ScaleByLandProportion(), and Size().
|
staticprivate |
Size of the map along the X.
Definition at line 229 of file map_func.h.
Referenced by Allocate(), and SizeX().
|
staticprivate |
Size of the map along the Y.
Definition at line 230 of file map_func.h.
Referenced by Allocate(), and SizeY().
|
staticprivate |
_map_size - 1 (to mask the mapsize)
Definition at line 232 of file map_func.h.
Referenced by Allocate(), and WrapToMap().