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()
|
default |
Hex map.
成员函数说明
◆ addRoad()
| Result< void > eve::hexmap::HexMap::addRoad | ( | HexCoordinates | c, |
| HexDirection | direction | ||
| ) |
Adds a road through direction when both cells can carry one.
在文件 HexMap.cpp 第 578 行定义.
引用了 c, direction, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, getNeighbor(), eve::hexmap::HexFlags::hasRiverThrough(), eve::InvalidArgument, eve::hexmap::opposite(), eve::hexmap::HexValues::specialIndex(), eve::Result< T >::success(), eve::hexmap::HexCellData::values , 以及 eve::hexmap::HexFlags::withRoad().
◆ cell()
|
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()
|
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()
|
inlinenoexcept |
Total number of cells.
被这些函数引用 eve::hexmap::HexMapModule::adoptGrid(), eve::hexmap::applyHexTerrain(), eve::hexmap::HexMapModule::applyTerrain(), eve::hexmap::HexUnitRegistry::beginTravel(), eve::hexmap::buildFogMesh(), eve::hexmap::collectVisibleCells(), eve::hexmap::findPath(), eve::hexmap::generateHexMap(), eve::hexmap::HexMapModule::newGrid(), eve::hexmap::HexUnitRegistry::refreshPositions(), eve::hexmap::HexUnitRegistry::restore(), eve::hexmap::saveHexMap(), eve::hexmap::snapshotHexTerrain() , 以及 eve::hexmap::HexMapModule::syncScratch().
◆ cellCountX()
|
inlinenoexcept |
Number of columns.
被这些函数引用 eve::hexmap::generateHexMap(), reset(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().
◆ cellCountZ()
|
inlinenoexcept |
Number of rows.
被这些函数引用 eve::hexmap::generateHexMap(), reset(), eve::hexmap::saveHexMap() , 以及 eve::hexmap::snapshotHexTerrain().
◆ cellGroundPosition()
|
inlinenoexcept |
Cell centre at y = 0 (no elevation, no perturbation).
被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 eve::hexmap::buildWaterMesh().
◆ cellPosition()
|
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()
|
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.
- 参数
-
chunkIndex Chunk to address. column Column inside the chunk, [0, kChunkSizeX).row Row 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()
|
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()
|
noexcept |
Chunk column of a chunk index.
在文件 HexMap.cpp 第 107 行定义.
◆ chunkCount()
|
inlinenoexcept |
Total number of chunks.
被这些函数引用 eve::hexmap::buildFeatureMesh(), eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildTerrainMesh(), eve::hexmap::buildWallMesh(), eve::hexmap::buildWaterMesh(), eve::hexmap::HexMapModule::chunkMeshAt(), markAllChunksDirty(), eve::hexmap::HexMapModule::rebuildChunk() , 以及 reset().
◆ chunkCountX()
|
inlinenoexcept |
◆ chunkCountZ()
|
inlinenoexcept |
◆ chunkIndexOf()
|
noexcept |
Chunk index owning coordinates, or -1 when outside the grid.
在文件 HexMap.cpp 第 102 行定义.
被这些函数引用 eve::hexmap::HexVisibility::decrease() , 以及 eve::hexmap::HexVisibility::increase().
◆ chunkRowOf()
|
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()
|
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.
引用了 column.
被这些函数引用 eve::hexmap::HexUnitRegistry::addUnit(), eve::hexmap::buildFogMesh(), collectBrush(), eve::hexmap::collectVisibleCells(), editElevation(), editFeatureLevel(), editTerrainType(), editWaterLevel(), eve::hexmap::findPath() , 以及 eve::hexmap::isValidDestination().
◆ coordinatesAt()
|
noexcept |
Coordinates of a linear cell index; out-of-range indices return (0, 0).
在文件 HexMap.cpp 第 69 行定义.
引用了 eve::hexmap::HexCoordinates::fromOffset() , 以及 index.
被这些函数引用 eve::hexmap::HexUnitRegistry::advance(), eve::hexmap::applyHexTerrain(), eve::hexmap::HexUnitRegistry::beginTravel(), eve::hexmap::collectVisibleCells(), eve::hexmap::HexVisibility::decrease(), editElevation(), editFeatureLevel(), editTerrainType(), editWaterLevel(), eve::hexmap::findPath(), eve::hexmap::generateHexMap(), eve::hexmap::HexVisibility::increase(), eve::hexmap::loadHexMap(), eve::hexmap::HexUnitRegistry::refreshVisibility(), eve::hexmap::HexUnitRegistry::removeUnit() , 以及 eve::hexmap::HexUnitRegistry::restore().
◆ dirtyChunkCount()
|
inlinenoexcept |
◆ edgeTypeTo()
|
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.
- 参数
-
center Brush centre. radius Hex distance reached by the brush; 0 edits only the centre. delta Elevation change; clamped per cell to the editable range.
- 返回
- Success, or InvalidArgument when
centeris outside the grid orradiusis 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 | ||
| ) |
Applies additive change to one feature level (0 urban, 1 farm, 2 plant).
在文件 HexMap.cpp 第 686 行定义.
引用了 cellAt(), cells, center, collectBrush(), contains(), coordinatesAt(), current, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, layer, eve::hexmap::next(), radius, setFarmLevel(), setPlantLevel(), setUrbanLevel() , 以及 eve::Result< T >::success().
◆ editTerrainType()
| Result< void > eve::hexmap::HexMap::editTerrainType | ( | HexCoordinates | center, |
| std::int32_t | radius, | ||
| std::int32_t | terrainType | ||
| ) |
Paints a terrain palette index over a hex brush.
在文件 HexMap.cpp 第 674 行定义.
引用了 cells, center, collectBrush(), contains(), coordinatesAt(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, radius, setTerrainType(), eve::Result< T >::success() , 以及 terrainType().
◆ editWaterLevel()
| Result< void > eve::hexmap::HexMap::editWaterLevel | ( | HexCoordinates | center, |
| std::int32_t | radius, | ||
| std::int32_t | delta | ||
| ) |
Applies additive water-level change over a hex brush.
在文件 HexMap.cpp 第 661 行定义.
引用了 cells, center, collectBrush(), contains(), coordinatesAt(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, radius, setWaterLevel(), eve::Result< T >::success() , 以及 waterLevel.
◆ elevation()
|
noexcept |
在文件 HexMap.cpp 第 300 行定义.
被这些函数引用 eve::hexmap::buildRiverMesh() , 以及 eve::hexmap::moveCost().
◆ empty()
|
inlinenoexcept |
Whether the map holds any cell.
被这些函数引用 eve::hexmap::HexUnitRegistry::addUnit(), eve::hexmap::buildFeatureMesh(), eve::hexmap::buildFogMesh(), eve::hexmap::buildWallMesh(), eve::hexmap::collectVisibleCells(), eve::hexmap::findPath(), eve::hexmap::generateHexMap(), eve::hexmap::HexMapModule::rebuildChunk(), eve::hexmap::HexMapModule::rebuildDirtyChunks() , 以及 eve::hexmap::saveHexMap().
◆ farmLevel()
|
noexcept |
◆ flags()
|
noexcept |
Full packed flag record of a cell (zero when outside the grid).
在文件 HexMap.cpp 第 360 行定义.
被这些函数引用 eve::hexmap::moveCost() , 以及 setCellState().
◆ getNeighbor()
|
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()
|
noexcept |
◆ hasRiverThrough()
|
noexcept |
◆ hasRoad()
|
noexcept |
◆ indexOf()
|
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()
|
noexcept |
Whether a cell may ever be revealed by a viewer.
在文件 HexMap.cpp 第 352 行定义.
被这些函数引用 eve::hexmap::collectVisibleCells().
◆ isExplored()
|
noexcept |
Whether a cell has ever been seen by a viewer (the fog-of-war latch).
在文件 HexMap.cpp 第 348 行定义.
被这些函数引用 eve::hexmap::buildFogMesh().
◆ isUnderwater()
|
noexcept |
◆ isWalled()
|
noexcept |
◆ markAllChunksDirty()
|
noexcept |
Marks every chunk dirty.
在文件 HexMap.cpp 第 152 行定义.
引用了 chunkCount().
被这些函数引用 eve::hexmap::applyHexTerrain(), eve::hexmap::loadHexMap() , 以及 reset().
◆ markChunkDirtyAndNeighbors()
|
noexcept |
Marks one chunk and its direct chunk neighbours dirty.
在文件 HexMap.cpp 第 136 行定义.
被这些函数引用 eve::hexmap::HexVisibility::decrease() , 以及 eve::hexmap::HexVisibility::increase().
◆ noise()
|
inlinenoexcept |
Deterministic noise field shared by this map's mesh builders.
被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 eve::hexmap::buildWaterMesh().
◆ pickCell()
|
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.
- 参数
-
rayOrigin Ray origin in world space. rayDirection Normalised 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()
|
noexcept |
◆ removeRiver()
| Result< void > eve::hexmap::HexMap::removeRiver | ( | HexCoordinates | c | ) |
Removes every river connection of the cell and its neighbours.
在文件 HexMap.cpp 第 558 行定义.
引用了 c, direction, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, getNeighbor(), eve::InvalidArgument, eve::hexmap::kHexDirectionCount, eve::hexmap::opposite(), eve::Result< T >::success(), eve::hexmap::HexFlags::withoutRiverIn() , 以及 eve::hexmap::HexFlags::withoutRiverOut().
◆ removeRoads()
| Result< void > eve::hexmap::HexMap::removeRoads | ( | HexCoordinates | c | ) |
Removes every road of the cell and its neighbours.
在文件 HexMap.cpp 第 602 行定义.
引用了 c, direction, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, getNeighbor(), eve::InvalidArgument, eve::hexmap::kHexDirectionCount, eve::hexmap::opposite(), eve::hexmap::HexFlags::roadMask(), eve::Result< T >::success() , 以及 eve::hexmap::HexFlags::withoutRoad().
被这些函数引用 setElevation() , 以及 setSpecialIndex().
◆ 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.
- 参数
-
cellCountX Columns; positive multiple of kChunkSizeX.cellCountZ Rows; positive multiple of kChunkSizeZ.seed Deterministic 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()
|
inlinenoexcept |
Monotonic counter bumped by every mutation; used to detect stale meshes.
被这些函数引用 eve::hexmap::saveHexMap().
◆ seed()
|
inlinenoexcept |
The seed this map was built with.
被这些函数引用 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().
- 参数
-
c Cell to overwrite. values Packed values to store. flags Packed flags to store.
- 返回
- Success, or InvalidArgument when
cis 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 | ||
| ) |
Sets a cell's elevation, clamped to the editable range, and refreshes dependents.
在文件 HexMap.cpp 第 392 行定义.
引用了 c, direction, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), getNeighbor(), eve::Result< void >::ignore(), eve::InvalidArgument, eve::hexmap::kHexDirectionCount, eve::hexmap::HexMetrics::kMaxElevation, eve::hexmap::HexMetrics::kMinElevation, removeRoads(), eve::Result< T >::success() , 以及 value.
被这些函数引用 editElevation().
◆ 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().
◆ 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()
| Result< void > eve::hexmap::HexMap::setOutgoingRiver | ( | HexCoordinates | c, |
| HexDirection | direction | ||
| ) |
Forces a river to leave the cell through direction, mirroring the neighbour.
在文件 HexMap.cpp 第 514 行定义.
引用了 c, direction, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, getNeighbor(), eve::InvalidArgument, eve::hexmap::kHexDirectionCount, eve::hexmap::opposite(), previous, eve::Result< T >::success(), eve::hexmap::HexCellData::values, waterLevel, eve::hexmap::HexFlags::withoutRiverIn(), eve::hexmap::HexFlags::withoutRiverOut(), eve::hexmap::HexFlags::withoutRoad(), eve::hexmap::HexFlags::withRiverIn() , 以及 eve::hexmap::HexValues::withSpecialIndex().
◆ 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()
|
noexcept |
在文件 HexMap.cpp 第 324 行定义.
◆ 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.
◆ terrainType()
|
noexcept |
◆ urbanLevel()
|
noexcept |
◆ values()
|
noexcept |
Full packed value record of a cell (zero when outside the grid).
在文件 HexMap.cpp 第 356 行定义.
被这些函数引用 eve::hexmap::collectVisibleCells().
◆ waterLevel()
|
noexcept |
该类的文档由以下文件生成:
- src/modules/hexmap/HexMap.h
- src/modules/hexmap/HexMap.cpp