载入中...
搜索中...
未找到
eve::hexmap::HexMap类 参考

An editable, chunked, pointy-top hex map. 更多...

#include <HexMap.h>

Public 成员函数

 HexMap ()=default
 Hex map.
 
Result< void > reset (std::int32_t cellCountX, std::int32_t cellCountZ, std::uint32_t seed)
 Replaces the grid with a new cellCountX * cellCountZ map.
 
bool empty () const noexcept
 Whether the map holds any cell.
 
std::int32_t cellCountX () const noexcept
 Number of columns.
 
std::int32_t cellCountZ () const noexcept
 Number of rows.
 
std::int32_t chunkCountX () const noexcept
 Number of chunk columns.
 
std::int32_t chunkCountZ () const noexcept
 Number of chunk rows.
 
std::int32_t chunkCount () const noexcept
 Total number of chunks.
 
std::int32_t cellCount () const noexcept
 Total number of cells.
 
std::uint32_t seed () const noexcept
 The seed this map was built with.
 
std::uint64_t revision () const noexcept
 Monotonic counter bumped by every mutation; used to detect stale meshes.
 
const HexNoise & noise () const noexcept
 Deterministic noise field shared by this map's mesh builders.
 
bool contains (HexCoordinates coordinates) const noexcept
 Whether coordinates address a cell inside the grid.
 
std::int32_t indexOf (HexCoordinates coordinates) const noexcept
 Linear cell index of coordinates (offset order), or -1 when outside the grid.
 
HexCoordinates coordinatesAt (std::int32_t index) const noexcept
 Coordinates of a linear cell index; out-of-range indices return (0, 0).
 
const HexCellData * cell (HexCoordinates coordinates) const noexcept
 Cell record, or null when outside the grid. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer.
 
const HexCellData * cellAt (std::int32_t index) const noexcept
 Cell record by linear index, or null when out of range. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer.
 
bool getNeighbor (HexCoordinates coordinates, HexDirection direction, HexCoordinates &out) const noexcept
 Neighbour of coordinates in direction; false when it is off-grid.
 
HexEdgeType edgeTypeTo (HexCoordinates a, HexCoordinates b) const noexcept
 Relationship between two adjacent cells; Flat when not adjacent or out of range.
 
std::int32_t chunkIndexOf (HexCoordinates coordinates) const noexcept
 Chunk index owning coordinates, or -1 when outside the grid.
 
std::int32_t chunkColumnOf (std::int32_t chunkIndex) const noexcept
 Chunk column of a chunk index.
 
std::int32_t chunkRowOf (std::int32_t chunkIndex) const noexcept
 Chunk row of a chunk index.
 
HexCoordinates chunkCell (std::int32_t chunkIndex, std::int32_t column, std::int32_t row) const noexcept
 Coordinates of the cell at (column, row) inside a chunk.
 
HexVec3 chunkCenter (std::int32_t chunkIndex) const noexcept
 World-space centre of a chunk, at the first cell's elevation.
 
void markAllChunksDirty () noexcept
 Marks every chunk dirty.
 
void markChunkDirtyAndNeighbors (std::int32_t chunkIndex) noexcept
 Marks one chunk and its direct chunk neighbours dirty.
 
std::int32_t takeDirtyChunk () noexcept
 Pops the next dirty chunk.
 
std::int32_t dirtyChunkCount () const noexcept
 Number of chunks currently pending a rebuild.
 
HexVec3 cellPosition (HexCoordinates coordinates) const noexcept
 Cell centre including elevation and vertical perturbation.
 
HexVec3 cellGroundPosition (HexCoordinates coordinates) const noexcept
 Cell centre at y = 0 (no elevation, no perturbation).
 
Result< HexCoordinates > pickCell (HexVec3 rayOrigin, HexVec3 rayDirection) const noexcept
 Finds the cell under a world-space ray.
 
std::int32_t elevation (HexCoordinates c) const noexcept
 
std::int32_t waterLevel (HexCoordinates c) const noexcept
 
std::int32_t terrainType (HexCoordinates c) const noexcept
 
std::int32_t urbanLevel (HexCoordinates c) const noexcept
 
std::int32_t farmLevel (HexCoordinates c) const noexcept
 
std::int32_t plantLevel (HexCoordinates c) const noexcept
 
std::int32_t specialIndex (HexCoordinates c) const noexcept
 
bool isUnderwater (HexCoordinates c) const noexcept
 
bool hasRiver (HexCoordinates c) const noexcept
 
bool hasRoad (HexCoordinates c) const noexcept
 
bool hasRiverThrough (HexCoordinates c, HexDirection d) const noexcept
 
bool isWalled (HexCoordinates c) const noexcept
 
bool isExplored (HexCoordinates c) const noexcept
 Whether a cell has ever been seen by a viewer (the fog-of-war latch).
 
bool isExplorable (HexCoordinates c) const noexcept
 Whether a cell may ever be revealed by a viewer.
 
HexValues values (HexCoordinates c) const noexcept
 Full packed value record of a cell (zero when outside the grid).
 
HexFlags flags (HexCoordinates c) const noexcept
 Full packed flag record of a cell (zero when outside the grid).
 
Result< void > setElevation (HexCoordinates c, std::int32_t elevation)
 Sets a cell's elevation, clamped to the editable range, and refreshes dependents.
 
Result< void > setWaterLevel (HexCoordinates c, std::int32_t waterLevel)
 Sets a cell's water level, clamped to [0, maxElevation].
 
Result< void > setTerrainType (HexCoordinates c, std::int32_t terrainType)
 Sets a cell's terrain palette index, clamped to the palette range.
 
Result< void > setUrbanLevel (HexCoordinates c, std::int32_t level)
 Sets a cell's urban level, clamped to [0, 3].
 
Result< void > setFarmLevel (HexCoordinates c, std::int32_t level)
 Sets a cell's farm level, clamped to [0, 3].
 
Result< void > setPlantLevel (HexCoordinates c, std::int32_t level)
 Sets a cell's plant level, clamped to [0, 3].
 
Result< void > setSpecialIndex (HexCoordinates c, std::int32_t index)
 Sets a cell's special-feature index; ignored while the cell carries a river.
 
Result< void > setWalled (HexCoordinates c, bool walled)
 Sets whether a cell is walled.
 
Result< void > setExplored (HexCoordinates c, bool explored)
 Sets the explored (fog-of-war) latch of a cell.
 
Result< void > setExplorable (HexCoordinates c, bool explorable)
 Sets whether a cell may ever be explored.
 
Result< void > setCellState (HexCoordinates c, HexValues values, HexFlags flags)
 Writes a complete cell record verbatim.
 
Result< void > setOutgoingRiver (HexCoordinates c, HexDirection direction)
 Forces a river to leave the cell through direction, mirroring the neighbour.
 
Result< void > removeRiver (HexCoordinates c)
 Removes every river connection of the cell and its neighbours.
 
Result< void > addRoad (HexCoordinates c, HexDirection direction)
 Adds a road through direction when both cells can carry one.
 
Result< void > removeRoads (HexCoordinates c)
 Removes every road of the cell and its neighbours.
 
Result< void > editElevation (HexCoordinates center, std::int32_t radius, std::int32_t delta)
 Raises or lowers every cell within radius steps of center.
 
Result< void > editWaterLevel (HexCoordinates center, std::int32_t radius, std::int32_t delta)
 Applies additive water-level change over a hex brush.
 
Result< void > editTerrainType (HexCoordinates center, std::int32_t radius, std::int32_t terrainType)
 Paints a terrain palette index over a hex brush.
 
Result< void > editFeatureLevel (HexCoordinates center, std::int32_t radius, std::int32_t feature, std::int32_t delta)
 Applies additive change to one feature level (0 urban, 1 farm, 2 plant).
 
void collectBrush (HexCoordinates center, std::int32_t radius, std::vector< std::int32_t > &out) const
 Enumerates the cells of a hex brush into out (cleared first).
 

详细描述

An editable, chunked, pointy-top hex map.

The grid is rectangular in odd-row offset space: cellCountX columns and cellCountZ rows, with odd rows shifted half a cell to the right. Cells are partitioned into chunkSizeX * chunkSizeZ chunks; every mutation marks the owning chunk (and the chunks of affected neighbours) dirty so a renderer can rebuild only what changed.

Ownership and lifetime: HexMap owns its cell storage and its noise field and is a plain value type. It performs no I/O, opens no GPU resources and invokes no callbacks, so it is safe to hold on any single thread.

Determinism: cell positions, perturbation and any future generation step are derived from the construction seed and the cell coordinates only. Two maps built with the same size and seed produce identical positions.

在文件 HexMap.h 第 72 行定义.

构造及析构函数说明

◆ HexMap()

eve::hexmap::HexMap::HexMap ( )
default

Hex map.

成员函数说明

◆ addRoad()

◆ cell()

const HexCellData * eve::hexmap::HexMap::cell ( HexCoordinates  coordinates) const
noexcept

Cell record, or null when outside the grid. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer.

在文件 HexMap.cpp 第 79 行定义.

被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildWaterMesh() , 以及 eve::hexmap::isValidDestination().

◆ cellAt()

const HexCellData * eve::hexmap::HexMap::cellAt ( std::int32_t  index) const
noexcept

Cell record by linear index, or null when out of range. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer.

在文件 HexMap.cpp 第 74 行定义.

引用了 index.

被这些函数引用 editFeatureLevel(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().

◆ cellCount()

◆ cellCountX()

std::int32_t eve::hexmap::HexMap::cellCountX ( ) const
inlinenoexcept

Number of columns.

在文件 HexMap.h 第 94 行定义.

被这些函数引用 eve::hexmap::generateHexMap(), reset(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().

◆ cellCountZ()

std::int32_t eve::hexmap::HexMap::cellCountZ ( ) const
inlinenoexcept

Number of rows.

在文件 HexMap.h 第 96 行定义.

被这些函数引用 eve::hexmap::generateHexMap(), reset(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().

◆ cellGroundPosition()

HexVec3 eve::hexmap::HexMap::cellGroundPosition ( HexCoordinates  coordinates) const
inlinenoexcept

Cell centre at y = 0 (no elevation, no perturbation).

在文件 HexMap.h 第 198 行定义.

被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 eve::hexmap::buildWaterMesh().

◆ cellPosition()

HexVec3 eve::hexmap::HexMap::cellPosition ( HexCoordinates  coordinates) const
noexcept

Cell centre including elevation and vertical perturbation.

在文件 HexMap.cpp 第 170 行定义.

引用了 elevation, eve::hexmap::HexMetrics::elevationY(), level, position , 以及 eve::hexmap::HexCoordinates::toWorldPosition().

被这些函数引用 eve::hexmap::buildRoadMesh().

◆ chunkCell()

HexCoordinates eve::hexmap::HexMap::chunkCell ( std::int32_t  chunkIndex,
std::int32_t  column,
std::int32_t  row 
) const
noexcept

Coordinates of the cell at (column, row) inside a chunk.

Chunks are squares in odd-row offset space, so every mesh builder must enumerate cells through this helper rather than constructing axial coordinates from the loop indices directly.

参数
chunkIndexChunk to address.
columnColumn inside the chunk, [0, kChunkSizeX).
rowRow inside the chunk, [0, kChunkSizeZ).
返回
The cell's axial coordinates (not range checked).

在文件 HexMap.cpp 第 115 行定义.

引用了 column, eve::hexmap::HexCoordinates::fromOffset(), eve::hexmap::HexMetrics::kChunkSizeX, eve::hexmap::HexMetrics::kChunkSizeZ , 以及 offsetX.

被这些函数引用 eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 eve::hexmap::buildWaterMesh().

◆ chunkCenter()

HexVec3 eve::hexmap::HexMap::chunkCenter ( std::int32_t  chunkIndex) const
noexcept

World-space centre of a chunk, at the first cell's elevation.

在文件 HexMap.cpp 第 121 行定义.

引用了 a, b, eve::hexmap::HexMetrics::kChunkSizeX , 以及 eve::hexmap::HexMetrics::kChunkSizeZ.

◆ chunkColumnOf()

std::int32_t eve::hexmap::HexMap::chunkColumnOf ( std::int32_t  chunkIndex) const
noexcept

Chunk column of a chunk index.

在文件 HexMap.cpp 第 107 行定义.

◆ chunkCount()

◆ chunkCountX()

std::int32_t eve::hexmap::HexMap::chunkCountX ( ) const
inlinenoexcept

Number of chunk columns.

在文件 HexMap.h 第 98 行定义.

◆ chunkCountZ()

std::int32_t eve::hexmap::HexMap::chunkCountZ ( ) const
inlinenoexcept

Number of chunk rows.

在文件 HexMap.h 第 100 行定义.

◆ chunkIndexOf()

std::int32_t eve::hexmap::HexMap::chunkIndexOf ( HexCoordinates  coordinates) const
noexcept

Chunk index owning coordinates, or -1 when outside the grid.

在文件 HexMap.cpp 第 102 行定义.

被这些函数引用 eve::hexmap::HexVisibility::decrease() , 以及 eve::hexmap::HexVisibility::increase().

◆ chunkRowOf()

std::int32_t eve::hexmap::HexMap::chunkRowOf ( std::int32_t  chunkIndex) const
noexcept

Chunk row of a chunk index.

在文件 HexMap.cpp 第 111 行定义.

◆ collectBrush()

void eve::hexmap::HexMap::collectBrush ( HexCoordinates  center,
std::int32_t  radius,
std::vector< std::int32_t > &  out 
) const

Enumerates the cells of a hex brush into out (cleared first).

在文件 HexMap.cpp 第 621 行定义.

引用了 center, column, contains(), eve::hexmap::HexCoordinates::fromOffset(), radius , 以及 z.

被这些函数引用 editElevation(), editFeatureLevel(), editTerrainType() , 以及 editWaterLevel().

◆ contains()

bool eve::hexmap::HexMap::contains ( HexCoordinates  coordinates) const
inlinenoexcept

Whether coordinates address a cell inside the grid.

The grid is the rectangle [0, cellCountX) x [0, cellCountZ) in odd-row offset space. An axial pair is inside only when its offset column x + z/2 is in range, so cells with a negative axial X are valid members of the rectangle.

在文件 HexMap.h 第 122 行定义.

引用了 column.

被这些函数引用 eve::hexmap::HexUnitRegistry::addUnit(), eve::hexmap::buildFogMesh(), collectBrush(), eve::hexmap::collectVisibleCells(), editElevation(), editFeatureLevel(), editTerrainType(), editWaterLevel(), eve::hexmap::findPath() , 以及 eve::hexmap::isValidDestination().

◆ coordinatesAt()

◆ dirtyChunkCount()

std::int32_t eve::hexmap::HexMap::dirtyChunkCount ( ) const
inlinenoexcept

Number of chunks currently pending a rebuild.

在文件 HexMap.h 第 189 行定义.

◆ edgeTypeTo()

HexEdgeType eve::hexmap::HexMap::edgeTypeTo ( HexCoordinates  a,
HexCoordinates  b 
) const
noexcept

Relationship between two adjacent cells; Flat when not adjacent or out of range.

在文件 HexMap.cpp 第 94 行定义.

引用了 a, b, eve::hexmap::edgeType(), elevation , 以及 eve::hexmap::Flat.

◆ editElevation()

Result< void > eve::hexmap::HexMap::editElevation ( HexCoordinates  center,
std::int32_t  radius,
std::int32_t  delta 
)

Raises or lowers every cell within radius steps of center.

参数
centerBrush centre.
radiusHex distance reached by the brush; 0 edits only the centre.
deltaElevation change; clamped per cell to the editable range.
返回
Success, or InvalidArgument when center is outside the grid or radius is negative.

在文件 HexMap.cpp 第 648 行定义.

引用了 cells, center, collectBrush(), contains(), coordinatesAt(), elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, eve::hexmap::next(), radius, setElevation() , 以及 eve::Result< T >::success().

◆ editFeatureLevel()

Result< void > eve::hexmap::HexMap::editFeatureLevel ( HexCoordinates  center,
std::int32_t  radius,
std::int32_t  feature,
std::int32_t  delta 
)

◆ editTerrainType()

Result< void > eve::hexmap::HexMap::editTerrainType ( HexCoordinates  center,
std::int32_t  radius,
std::int32_t  terrainType 
)

◆ editWaterLevel()

Result< void > eve::hexmap::HexMap::editWaterLevel ( HexCoordinates  center,
std::int32_t  radius,
std::int32_t  delta 
)

◆ elevation()

std::int32_t eve::hexmap::HexMap::elevation ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 300 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildRiverMesh() , 以及 eve::hexmap::moveCost().

◆ empty()

◆ farmLevel()

std::int32_t eve::hexmap::HexMap::farmLevel ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 316 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::moveCost().

◆ flags()

HexFlags eve::hexmap::HexMap::flags ( HexCoordinates  c) const
noexcept

Full packed flag record of a cell (zero when outside the grid).

在文件 HexMap.cpp 第 360 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::moveCost() , 以及 setCellState().

◆ getNeighbor()

bool eve::hexmap::HexMap::getNeighbor ( HexCoordinates  coordinates,
HexDirection  direction,
HexCoordinates &  out 
) const
noexcept

Neighbour of coordinates in direction; false when it is off-grid.

在文件 HexMap.cpp 第 87 行定义.

引用了 direction , 以及 eve::hexmap::HexCoordinates::step().

被这些函数引用 addRoad(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildWaterMesh(), eve::hexmap::collectVisibleCells(), eve::hexmap::findPath(), removeRiver(), removeRoads(), setElevation() , 以及 setOutgoingRiver().

◆ hasRiver()

bool eve::hexmap::HexMap::hasRiver ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 332 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildRiverMesh().

◆ hasRiverThrough()

bool eve::hexmap::HexMap::hasRiverThrough ( HexCoordinates  c,
HexDirection  d 
) const
noexcept

在文件 HexMap.cpp 第 340 行定义.

引用了 c, cell , 以及 d.

被这些函数引用 eve::hexmap::buildRiverMesh().

◆ hasRoad()

bool eve::hexmap::HexMap::hasRoad ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 336 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildRoadMesh().

◆ indexOf()

std::int32_t eve::hexmap::HexMap::indexOf ( HexCoordinates  coordinates) const
noexcept

Linear cell index of coordinates (offset order), or -1 when outside the grid.

在文件 HexMap.cpp 第 64 行定义.

被这些函数引用 eve::hexmap::HexUnitRegistry::addUnit(), eve::hexmap::buildFogMesh(), eve::hexmap::collectVisibleCells() , 以及 eve::hexmap::findPath().

◆ isExplorable()

bool eve::hexmap::HexMap::isExplorable ( HexCoordinates  c) const
noexcept

Whether a cell may ever be revealed by a viewer.

在文件 HexMap.cpp 第 352 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::collectVisibleCells().

◆ isExplored()

bool eve::hexmap::HexMap::isExplored ( HexCoordinates  c) const
noexcept

Whether a cell has ever been seen by a viewer (the fog-of-war latch).

在文件 HexMap.cpp 第 348 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildFogMesh().

◆ isUnderwater()

bool eve::hexmap::HexMap::isUnderwater ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 328 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildWaterMesh().

◆ isWalled()

bool eve::hexmap::HexMap::isWalled ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 344 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::moveCost().

◆ markAllChunksDirty()

void eve::hexmap::HexMap::markAllChunksDirty ( )
noexcept

Marks every chunk dirty.

在文件 HexMap.cpp 第 152 行定义.

引用了 chunkCount().

被这些函数引用 eve::hexmap::applyHexTerrain(), eve::hexmap::loadHexMap() , 以及 reset().

◆ markChunkDirtyAndNeighbors()

void eve::hexmap::HexMap::markChunkDirtyAndNeighbors ( std::int32_t  chunkIndex)
noexcept

Marks one chunk and its direct chunk neighbours dirty.

在文件 HexMap.cpp 第 136 行定义.

引用了 column, cx, dx , 以及 dz.

被这些函数引用 eve::hexmap::HexVisibility::decrease() , 以及 eve::hexmap::HexVisibility::increase().

◆ noise()

const HexNoise & eve::hexmap::HexMap::noise ( ) const
inlinenoexcept

Deterministic noise field shared by this map's mesh builders.

在文件 HexMap.h 第 110 行定义.

被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 eve::hexmap::buildWaterMesh().

◆ pickCell()

Result< HexCoordinates > eve::hexmap::HexMap::pickCell ( HexVec3  rayOrigin,
HexVec3  rayDirection 
) const
noexcept

Finds the cell under a world-space ray.

The map has no collision geometry, so the ray is marched against the elevation plane of the candidate cell and refined until it converges.

参数
rayOriginRay origin in world space.
rayDirectionNormalised ray direction in world space.
返回
The hit cell, or NotFound when the ray misses the grid or points away.

在文件 HexMap.cpp 第 177 行定义.

引用了 best, direction, eve::hexmap::HexMetrics::elevationY(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCoordinates::fromOffset(), eve::hexmap::HexCoordinates::fromWorldPosition(), eve::InvalidArgument, eve::hexmap::HexMetrics::kElevationStep, eve::hexmap::HexMetrics::kMaxElevation, eve::hexmap::HexMetrics::kMinElevation, eve::hexmap::HexMetrics::kOuterRadius, mid, eve::NotFound, origin, pad, point, step, eve::Result< T >::success(), t, eve::hexmap::HexVec3::x, y, eve::hexmap::HexVec3::y , 以及 eve::hexmap::HexVec3::z.

◆ plantLevel()

std::int32_t eve::hexmap::HexMap::plantLevel ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 320 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::moveCost().

◆ removeRiver()

◆ removeRoads()

◆ reset()

Result< void > eve::hexmap::HexMap::reset ( std::int32_t  cellCountX,
std::int32_t  cellCountZ,
std::uint32_t  seed 
)

Replaces the grid with a new cellCountX * cellCountZ map.

Existing cells are discarded and every chunk is marked dirty. Cell count must be a positive multiple of the chunk size in each dimension because chunk meshes own the blend strips on their north and west borders.

参数
cellCountXColumns; positive multiple of kChunkSizeX.
cellCountZRows; positive multiple of kChunkSizeZ.
seedDeterministic seed for the noise field.
返回
Success, or InvalidArgument when a dimension is out of range.

在文件 HexMap.cpp 第 37 行定义.

引用了 cellCountX(), cellCountZ(), chunkCount(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::hexmap::HexMetrics::kChunkSizeX, eve::hexmap::HexMetrics::kChunkSizeZ, markAllChunksDirty(), eve::hexmap::HexNoise::reset(), seed(), eve::Result< T >::success(), u, eve::hexmap::HexCellData::values, eve::hexmap::HexValues::withElevation() , 以及 eve::hexmap::HexValues::withWaterLevel().

被这些函数引用 eve::hexmap::applyHexTerrain(), eve::procgen::generateHexTerrain(), eve::hexmap::loadHexMap() , 以及 eve::hexmap::HexMapModule::newGrid().

◆ revision()

std::uint64_t eve::hexmap::HexMap::revision ( ) const
inlinenoexcept

Monotonic counter bumped by every mutation; used to detect stale meshes.

在文件 HexMap.h 第 108 行定义.

被这些函数引用 eve::hexmap::saveHexMap().

◆ seed()

std::uint32_t eve::hexmap::HexMap::seed ( ) const
inlinenoexcept

The seed this map was built with.

在文件 HexMap.h 第 106 行定义.

被这些函数引用 reset(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().

◆ setCellState()

Result< void > eve::hexmap::HexMap::setCellState ( HexCoordinates  c,
HexValues  values,
HexFlags  flags 
)

Writes a complete cell record verbatim.

This is the restore path used by the save format. It deliberately skips the neighbour fix-ups of the individual authoring setters (setOutgoingRiver, addRoad, ...) because a payload carries both sides of every connection; the caller is responsible for a consistent payload and must finish with markAllChunksDirty().

参数
cCell to overwrite.
valuesPacked values to store.
flagsPacked flags to store.
返回
Success, or InvalidArgument when c is outside the grid. @cost Marks the owning chunk and its neighbours dirty.

在文件 HexMap.cpp 第 505 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), flags(), eve::InvalidArgument, eve::Result< T >::success() , 以及 values.

被这些函数引用 eve::hexmap::applyHexTerrain() , 以及 eve::hexmap::loadHexMap().

◆ setElevation()

Result< void > eve::hexmap::HexMap::setElevation ( HexCoordinates  c,
std::int32_t  elevation 
)

◆ setExplorable()

Result< void > eve::hexmap::HexMap::setExplorable ( HexCoordinates  c,
bool  explorable 
)

Sets whether a cell may ever be explored.

在文件 HexMap.cpp 第 494 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ setExplored()

Result< void > eve::hexmap::HexMap::setExplored ( HexCoordinates  c,
bool  explored 
)

Sets the explored (fog-of-war) latch of a cell.

在文件 HexMap.cpp 第 482 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().

被这些函数引用 eve::hexmap::HexVisibility::increase().

◆ setFarmLevel()

Result< void > eve::hexmap::HexMap::setFarmLevel ( HexCoordinates  c,
std::int32_t  level 
)

Sets a cell's farm level, clamped to [0, 3].

在文件 HexMap.cpp 第 448 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.

被这些函数引用 editFeatureLevel().

◆ setOutgoingRiver()

◆ setPlantLevel()

Result< void > eve::hexmap::HexMap::setPlantLevel ( HexCoordinates  c,
std::int32_t  level 
)

Sets a cell's plant level, clamped to [0, 3].

在文件 HexMap.cpp 第 456 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.

被这些函数引用 editFeatureLevel().

◆ setSpecialIndex()

Result< void > eve::hexmap::HexMap::setSpecialIndex ( HexCoordinates  c,
std::int32_t  index 
)

Sets a cell's special-feature index; ignored while the cell carries a river.

在文件 HexMap.cpp 第 464 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, removeRoads() , 以及 eve::Result< T >::success().

◆ setTerrainType()

Result< void > eve::hexmap::HexMap::setTerrainType ( HexCoordinates  c,
std::int32_t  terrainType 
)

Sets a cell's terrain palette index, clamped to the palette range.

在文件 HexMap.cpp 第 430 行定义.

引用了 c, eve::hexmap::clampTerrainType(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.

被这些函数引用 editTerrainType().

◆ setUrbanLevel()

Result< void > eve::hexmap::HexMap::setUrbanLevel ( HexCoordinates  c,
std::int32_t  level 
)

Sets a cell's urban level, clamped to [0, 3].

在文件 HexMap.cpp 第 440 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.

被这些函数引用 editFeatureLevel().

◆ setWalled()

Result< void > eve::hexmap::HexMap::setWalled ( HexCoordinates  c,
bool  walled 
)

Sets whether a cell is walled.

在文件 HexMap.cpp 第 474 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ setWaterLevel()

Result< void > eve::hexmap::HexMap::setWaterLevel ( HexCoordinates  c,
std::int32_t  waterLevel 
)

Sets a cell's water level, clamped to [0, maxElevation].

在文件 HexMap.cpp 第 419 行定义.

引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::hexmap::HexMetrics::kMaxElevation, eve::Result< T >::success() , 以及 value.

被这些函数引用 editWaterLevel().

◆ specialIndex()

std::int32_t eve::hexmap::HexMap::specialIndex ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 324 行定义.

引用了 c , 以及 cell.

◆ takeDirtyChunk()

std::int32_t eve::hexmap::HexMap::takeDirtyChunk ( )
noexcept

Pops the next dirty chunk.

返回
The dirty chunk index, or -1 when nothing is pending.
注解
Callers loop until -1 is returned; the returned chunk is no longer reported dirty until it is mutated again.

在文件 HexMap.cpp 第 160 行定义.

引用了 u.

被这些函数引用 eve::hexmap::HexMapModule::rebuildDirtyChunks().

◆ terrainType()

std::int32_t eve::hexmap::HexMap::terrainType ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 308 行定义.

引用了 c , 以及 cell.

被这些函数引用 editTerrainType().

◆ urbanLevel()

std::int32_t eve::hexmap::HexMap::urbanLevel ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 312 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::moveCost().

◆ values()

HexValues eve::hexmap::HexMap::values ( HexCoordinates  c) const
noexcept

Full packed value record of a cell (zero when outside the grid).

在文件 HexMap.cpp 第 356 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::collectVisibleCells().

◆ waterLevel()

std::int32_t eve::hexmap::HexMap::waterLevel ( HexCoordinates  c) const
noexcept

在文件 HexMap.cpp 第 304 行定义.

引用了 c , 以及 cell.

被这些函数引用 eve::hexmap::buildWaterMesh().


该类的文档由以下文件生成: