OpenTTD Source
20241108-master-g80f628063a
|
Size related data of the map. More...
#include <map_func.h>
Data Structures | |
struct | IterateWrapper |
struct | Iterator |
Iterator to iterate all Tiles. More... | |
Static Public Member Functions | |
static void | Allocate (uint size_x, uint size_y) |
(Re)allocates a map with the given dimension More... | |
static debug_inline uint | LogX () |
Logarithm of the map size along the X side. More... | |
static uint | LogY () |
Logarithm of the map size along the y side. More... | |
static debug_inline uint | SizeX () |
Get the size of the map along the X. More... | |
static uint | SizeY () |
Get the size of the map along the Y. More... | |
static debug_inline uint | Size () |
Get the size of the map. More... | |
static debug_inline uint | MaxX () |
Gets the maximum X coordinate within the map, including MP_VOID. More... | |
static uint | MaxY () |
Gets the maximum Y coordinate within the map, including MP_VOID. More... | |
static TileIndex | WrapToMap (TileIndex tile) |
'Wraps' the given "tile" so it is within the map. More... | |
static uint | ScaleBySize (uint n) |
Scales the given value by the map size, where the given value is for a 256 by 256 map. More... | |
static uint | ScaleBySize1D (uint n) |
Scales the given value by the maps circumference, where the given value is for a 256 by 256 map. More... | |
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. More... | |
static IterateWrapper | Iterate () |
Returns an iterable ensemble of all Tiles. More... | |
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) | |
Size related data of the map.
Definition at line 206 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 36 of file map.cpp.
References IsInsideMM(), MAX_MAP_SIZE, MIN_MAP_SIZE, size_x, and size_y.
|
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 354 of file map_func.h.
References Tile::base_tiles.
Referenced by CrashLog::WriteSavegame().
|
inlinestatic |
Returns an iterable ensemble of all Tiles.
Definition at line 363 of file map_func.h.
|
inlinestatic |
Logarithm of the map size along the X side.
Definition at line 251 of file map_func.h.
Referenced by HeightMapGenerate(), RunTileLoop(), ScaleBySize(), ScaleBySize1D(), StartupIndustryDailyChanges(), and TGPGetMaxHeight().
|
inlinestatic |
Logarithm of the map size along the y side.
Definition at line 261 of file map_func.h.
References log_y.
Referenced by HeightMapGenerate(), RunTileLoop(), ScaleBySize(), ScaleBySize1D(), StartupIndustryDailyChanges(), and TGPGetMaxHeight().
|
inlinestatic |
Gets the maximum X coordinate within the map, including MP_VOID.
Definition at line 297 of file map_func.h.
Referenced by CheckIfCanLevelIndustryPlatform(), DistanceFromEdgeDir(), Station::GetCatchmentRect(), GetTileHeightBelowAircraft(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GUIPlaceProcDragXY(), HandleCrashedAircraft(), IsTileFlat(), IsTunnelInWay(), LoadTownData(), SetWaterClassDependingOnSurroundings(), and TryBuildLightHouse().
|
inlinestatic |
Gets the maximum Y coordinate within the map, including MP_VOID.
Definition at line 306 of file map_func.h.
References SizeY().
Referenced by CheckIfCanLevelIndustryPlatform(), DistanceFromEdgeDir(), Station::GetCatchmentRect(), GetTileHeightBelowAircraft(), GetTileMaxZ(), GetTileSlopeZ(), GetTileZ(), GUIPlaceProcDragXY(), HandleCrashedAircraft(), IsTileFlat(), IsTunnelInWay(), LoadTownData(), SetWaterClassDependingOnSurroundings(), and TryBuildLightHouse().
|
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 328 of file map_func.h.
References CeilDiv(), LogX(), and LogY().
Referenced by CreateRivers(), DecrementTreeCounter(), IndustryBuildData::EconomyMonthlyLoop(), 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 341 of file map_func.h.
|
inlinestatic |
Get the size of the map.
Definition at line 288 of file map_func.h.
Referenced by AfterLoadCompanyStats(), CalculateCoverageLine(), OrthogonalTileArea::ClampToMap(), ClickChangeMaxHlCheat(), CmdBuildCanal(), CmdBuildLongRoad(), CmdBuildObjectArea(), CmdClearArea(), CmdConvertRail(), CmdConvertRoad(), CmdLevelLand(), CmdPlantTree(), CmdRemoveFromRailStation(), CmdRemoveFromRailWaypoint(), CmdRemoveFromRoadWaypoint(), CmdRemoveLongRoad(), CmdSignalTrackHelper(), CmdTerraformLand(), DiagonalTileArea::DiagonalTileArea(), CommandHelper< Tcmd, Tret(*)(DoCommandFlag, Targs...), true >::Do(), GetTropicZone(), GrowTownAtRoad(), GrowTownInTile(), IsInnerTile(), IsValidTile(), MAPTChunkHandler::Load(), MAPHChunkHandler::Load(), MAPOChunkHandler::Load(), MAP2ChunkHandler::Load(), M3LOChunkHandler::Load(), M3HIChunkHandler::Load(), MAP5ChunkHandler::Load(), MAPEChunkHandler::Load(), MAP7ChunkHandler::Load(), MAP8ChunkHandler::Load(), MakeHeightmapScreenshot(), MarkDirtyAdjacentLevelCrossingTiles(), MoveWaypointsToBaseStations(), OrthogonalTileArea::OrthogonalTileArea(), MAPTChunkHandler::Save(), MAPHChunkHandler::Save(), MAPOChunkHandler::Save(), MAP2ChunkHandler::Save(), M3LOChunkHandler::Save(), M3HIChunkHandler::Save(), MAP5ChunkHandler::Save(), MAPEChunkHandler::Save(), MAP7ChunkHandler::Save(), MAP8ChunkHandler::Save(), SetTileHeight(), SetTileType(), SetTropicZone(), TerraformTileHeight(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), UpdateHousesAndTowns(), UpdateLevelCrossing(), UpdateNearestTownForRoadTiles(), and Town::~Town().
|
inlinestatic |
Get the size of the map along the X.
Definition at line 270 of file map_func.h.
Referenced by AllocHeightMap(), CheckScaledDistanceFromEdge(), OrthogonalTileArea::ClampToMap(), DistanceFromEdge(), FixSlopes(), FlatEmptyWorld(), AirportSpec::IsWithinMapBounds(), MakeScreenshotWithConfirm(), and ServerNetworkAdminSocketHandler::SendWelcome().
|
inlinestatic |
Get the size of the map along the Y.
Definition at line 279 of file map_func.h.
References size_y.
Referenced by AllocHeightMap(), CheckScaledDistanceFromEdge(), OrthogonalTileArea::ClampToMap(), DistanceFromEdge(), FixSlopes(), FlatEmptyWorld(), AirportSpec::IsWithinMapBounds(), MakeScreenshotWithConfirm(), MaxY(), and ServerNetworkAdminSocketHandler::SendWelcome().
'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 317 of file map_func.h.
References tile_mask.
Referenced by RandomTileSeed(), and SetupFarmFieldFence().