载入中...
搜索中...
未找到
HexMapModule.cpp
浏览该文件的文档.
31[[nodiscard]] HexCoordinates fromScriptCell(int x, int z) noexcept { return HexCoordinates::fromOffset(x, z); }
33[[nodiscard]] HexDirection toDirection(std::int32_t direction) noexcept { return static_cast<HexDirection>(direction); }
57 if (!gfx) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "applyTerrain requires a graphics device", "hexmap"));
59 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "applyTerrain requires a planar hex.terrain bake", "hexmap"));
75 if (!gfx) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "adoptGrid requires a graphics device", "hexmap"));
76 if (restored.empty()) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "adoptGrid requires a non-empty grid", "hexmap"));
96Result<void> HexMapModule::newGrid(graphics::Graphics* gfx, std::int32_t cellCountX, std::int32_t cellCountZ,
98 if (!gfx) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "newGrid requires a graphics device", "hexmap"));
99 if (cellCountX <= 0 || cellCountZ <= 0) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map size must be positive", "hexmap"));
104 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map size exceeds the " + std::to_string(kMaxHexGridDimension) +
162 return gfx->newMeshFromArrays(meshData.positions().data(), meshData.normals().data(), meshData.uvs().data(),
202Result<void> HexMapModule::newSphere(graphics::Graphics* gfx, std::int32_t subdivision, float radius,
204 if (gfx == nullptr) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex sphere needs a graphics device", "hexmap"));
215Result<void> HexMapModule::applySphereTerrain(graphics::Graphics* gfx, const HexTerrainBake& bake) {
216 if (gfx == nullptr) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex sphere needs a graphics device", "hexmap"));
217 if (sphere_.empty()) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex sphere map has no cells", "hexmap"));
219 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "applySphereTerrain requires a hex.sphere bake", "hexmap"));
227 if (gfx == nullptr) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex sphere needs a graphics device", "hexmap"));
228 if (sphere_.empty()) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex sphere map has no cells", "hexmap"));
249 !gfx->updateMeshVertices(mesh, data.positions().data(), data.normals().data(), data.uvs().data(),
256 mesh = gfx->newMeshFromArrays(data.positions().data(), data.normals().data(), data.uvs().data(),
264 if (!uploaded) return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "the graphics backend refused the hex sphere mesh upload", "hexmap"));
280 cls.addFunc("newGrid", [vm](HexMapModule* self, graphics::Graphics* gfx, int cellCountX, int cellCountZ, int seed) {
281 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
283 return script::projectResult(vm, self->newGrid(gfx, cellCountX, cellCountZ, static_cast<std::uint32_t>(seed)));
286 cls.addFunc("cellCountX", [](HexMapModule* self) { return self ? self->map().cellCountX() : 0; });
287 cls.addFunc("cellCountZ", [](HexMapModule* self) { return self ? self->map().cellCountZ() : 0; });
288 cls.addFunc("chunkCountX", [](HexMapModule* self) { return self ? self->map().chunkCountX() : 0; });
289 cls.addFunc("chunkCountZ", [](HexMapModule* self) { return self ? self->map().chunkCountZ() : 0; });
290 cls.addFunc("chunkCount", [](HexMapModule* self) { return self ? self->map().chunkCount() : 0; });
291 cls.addFunc("seed", [](HexMapModule* self) { return self ? static_cast<std::int64_t>(self->map().seed()) : 0; });
293 cls.addFunc("dirtyChunkCount", [](HexMapModule* self) { return self ? self->map().dirtyChunkCount() : 0; });
297 cls.addFunc("takeDirtyChunk", [](HexMapModule* self) { return self ? self->map().takeDirtyChunk() : -1; });
302 [](HexMapModule* self, graphics::Graphics* gfx) { return self ? self->rebuildDirtyChunks(gfx) : 0; });
303 cls.addFunc("chunkMeshAt", [](HexMapModule* self, int chunkIndex, int surface) -> graphics::Mesh* {
312 [](HexMapModule* self, int chunkIndex) { return self ? self->map().chunkCenter(chunkIndex).x : 0.f; });
314 [](HexMapModule* self, int chunkIndex) { return self ? self->map().chunkCenter(chunkIndex).y : 0.f; });
316 [](HexMapModule* self, int chunkIndex) { return self ? self->map().chunkCenter(chunkIndex).z : 0.f; });
363 cls.addFunc("pickCell", [vm](HexMapModule* self, float ox, float oy, float oz, float dx, float dy, float dz) {
379 return script::projectResult(vm, self->map().pickCell(HexVec3{ox, oy, oz}, HexVec3{dx, dy, dz}), project);
384 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
388 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
392 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
396 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
400 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
404 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
408 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
412 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
416 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
418 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "river direction must be in [0, 5]", "hexmap")));
419 return script::projectResult(vm, self->map().setOutgoingRiver(fromScriptCell(x, z), toDirection(direction)));
422 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
426 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
428 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "road direction must be in [0, 5]", "hexmap")));
429 return script::projectResult(vm, self->map().addRoad(fromScriptCell(x, z), toDirection(direction)));
432 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
438 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
439 return script::projectResult(vm, self->map().editElevation(fromScriptCell(x, z), radius, delta));
442 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
443 return script::projectResult(vm, self->map().editWaterLevel(fromScriptCell(x, z), radius, delta));
445 cls.addFunc("editTerrainType", [vm](HexMapModule* self, int x, int z, int radius, int terrainType) {
446 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
447 return script::projectResult(vm, self->map().editTerrainType(fromScriptCell(x, z), radius, terrainType));
449 cls.addFunc("editFeatureLevel", [vm](HexMapModule* self, int x, int z, int radius, int feature, int delta) {
450 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
451 return script::projectResult(vm, self->map().editFeatureLevel(fromScriptCell(x, z), radius, feature, delta));
455 cls.addFunc("applyTerrain", [vm](HexMapModule* self, graphics::Graphics* gfx, ssq::Object bake) {
456 if (!self || !gfx) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
459 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "applyTerrain requires a hex.terrain bake object", "hexmap")));
473 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
477 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
492 cls.addFunc("unitCount", [](HexMapModule* self) { return self ? self->units().unitCount() : 0; });
498 Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")),
502 vm, self->units().addUnit(self->map(), self->visibility(), self->scratch(), fromScriptCell(x, z), orientation),
506 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
536 return script::projectResult(vm, self->units().advance(self->map(), self->visibility(), self->scratch(), unitId, 0.f),
540 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
542 if (!owned) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "unit path must be an array of [x, z] cells", "hexmap")));
544 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "unit path must be an array of [x, z] cells", "hexmap")));
551 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "unit path entries must be [x, z] pairs", "hexmap")));
555 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "unit path entries must hold numeric cells", "hexmap")));
557 self->map().indexOf(fromScriptCell(static_cast<int>(ax.asInt()), static_cast<int>(az.asInt())));
558 if (index < 0) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "unit path leaves the hex map", "hexmap")));
576 const HexCoordinates coordinates = self ? self->map().coordinatesAt(path.cells[i]) : HexCoordinates{};
588 Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")),
600 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
605 vm, saved.status(), Value::string(std::string(reinterpret_cast<const char*>(bytes.data()), bytes.size())));
608 if (!self || !gfx) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
619 "newSphere", [vm](HexMapModule* self, graphics::Graphics* gfx, int subdivision, float radius, int seed) {
620 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
625 cls.addFunc("applySphereTerrain", [vm](HexMapModule* self, graphics::Graphics* gfx, ssq::Object bake) {
626 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
629 return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "applySphereTerrain requires a hex.sphere bake object", "hexmap")));
635 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
638 cls.addFunc("sphereReady", [](HexMapModule* self) { return self != nullptr && !self->sphere().empty(); });
639 cls.addFunc("sphereCellCount", [](HexMapModule* self) { return self ? self->sphere().cellCount() : 0; });
640 cls.addFunc("spherePentagonCount", [](HexMapModule* self) { return self ? self->sphere().pentagonCount() : 0; });
641 cls.addFunc("sphereSubdivision", [](HexMapModule* self) { return self ? self->sphere().subdivision() : 0; });
642 cls.addFunc("sphereRadius", [](HexMapModule* self) { return self ? self->sphere().sphereRadius() : 0.f; });
643 cls.addFunc("sphereElevationStep", [](HexMapModule* self) { return self ? self->sphere().elevationStep() : 0.f; });
644 cls.addFunc("sphereCellSpacing", [](HexMapModule* self) { return self ? self->sphere().cellSpacing() : 0.f; });
646 [](HexMapModule* self, int cell) { return self != nullptr && self->sphere().isPentagon(cell); });
670 cls.addFunc("sphereElevation", [](HexMapModule* self, int cell) { return self ? self->sphere().elevation(cell) : 0; });
676 [](HexMapModule* self, int cell) { return self != nullptr && self->sphere().isUnderwater(cell); });
698 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
702 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
706 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
709 cls.addFunc("sphereEditTerrainType", [vm](HexMapModule* self, int cell, int radius, int terrainType) {
710 if (!self) return script::projectResult(vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "hex map module is not available", "hexmap")));
714 [](HexMapModule* self) -> graphics::Mesh* { return self ? self->sphereTerrainMesh() : nullptr; });
716 [](HexMapModule* self) -> graphics::Mesh* { return self ? self->sphereWaterMesh() : nullptr; });
Stable, structured diagnostics shared by engine modules.
Deterministic feature placement for hex decorations and walls.
Script-facing hex map module: one editable map plus its chunk meshes.
Mesh generation for the spherical hex map surface.
Terrain bake hexmap applies; procgen produces the payload.
The single Squirrel projection for common Result, Status and Value.
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Value string(std::string value)
Compatibility factory for a string value.
Definition Value.h:110
Definition Graphics.h:125
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:927
virtual bool updateMeshVertices(Mesh *mesh, const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount)=0
In-place update of a mesh's vertex/index data (CPU -> host-visible VBO). Mirrors bakeMeshMorph: the u...
virtual Mesh * newMeshFromArrays(const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount)=0
Upload a triangle mesh from packed CPU arrays. Owned by Graphics. posXYZ required (vertexCount*3)....
Owns the active hex map and the GPU meshes generated from it.
Definition HexMapModule.h:43
void releaseMeshes(graphics::Graphics *gfx)
Releases every mesh owned by the module.
Definition HexMapModule.cpp:86
Result< void > rebuildSphere(graphics::Graphics *gfx)
Rebuilds the whole-sphere terrain and ocean meshes from the current cells.
Definition HexMapModule.cpp:226
~HexMapModule() override
Destructor; GPU meshes must already have been released.
void syncScratch()
Re-sizes the search scratch to the active map. @cost Proportional to the cell count; called by newGri...
Definition HexMapModule.cpp:52
void releaseSphereMeshes(graphics::Graphics *gfx) noexcept
Releases every mesh owned by the spherical map.
Definition HexMapModule.cpp:193
Result< void > adoptGrid(graphics::Graphics *gfx, HexMap &&restored, const std::vector< HexUnitState > &units)
Replaces the active grid with an already-decoded map.
Definition HexMapModule.cpp:73
HexMapModule()
Constructs an empty module with no map and no meshes.
Result< void > applyTerrain(graphics::Graphics *gfx, const HexTerrainBake &bake)
Apply a procgen planar terrain bake and drop every unit.
Definition HexMapModule.cpp:56
Result< void > newGrid(graphics::Graphics *gfx, std::int32_t cellCountX, std::int32_t cellCountZ, std::uint32_t seed)
Replaces the active grid and releases the meshes of the previous one.
Definition HexMapModule.cpp:96
graphics::Mesh * chunkMeshAt(std::int32_t chunkIndex, HexSurface surface) const
Borrowed GPU mesh of one chunk surface.
Definition HexMapModule.cpp:120
Result< void > newSphere(graphics::Graphics *gfx, std::int32_t subdivision, float radius, std::uint32_t seed)
Replaces the spherical map and releases the meshes of the previous one.
Definition HexMapModule.cpp:202
std::int32_t rebuildChunk(graphics::Graphics *gfx, std::int32_t chunkIndex)
Rebuilds all surfaces of one chunk.
Definition HexMapModule.cpp:130
std::int32_t rebuildDirtyChunks(graphics::Graphics *gfx)
Rebuilds every chunk surface currently marked dirty.
Definition HexMapModule.cpp:180
Result< void > applySphereTerrain(graphics::Graphics *gfx, const HexTerrainBake &bake)
Apply a procgen sphere terrain bake and rebuild both meshes.
Definition HexMapModule.cpp:215
Result< void > reset(std::int32_t cellCountX, std::int32_t cellCountZ, std::uint32_t seed)
Replaces the grid with a new cellCountX * cellCountZ map.
Definition HexMap.cpp:37
CPU-side triangle soup for one hex chunk surface.
Definition HexMeshData.h:24
const std::vector< float > & uvs() const noexcept
Texture coordinate stream (uv per vertex).
Definition HexMeshData.h:60
const std::vector< float > & positions() const noexcept
Interleaved-free position stream (xyz per vertex).
Definition HexMeshData.h:56
const std::vector< std::uint32_t > & indices() const noexcept
Triangle index stream.
Definition HexMeshData.h:62
const std::vector< float > & normals() const noexcept
Normal stream (xyz per vertex), valid after finalize().
Definition HexMeshData.h:58
void resize(std::int32_t cellCount)
Sizes the scratch for cellCount cells, preserving nothing.
Definition HexSearch.cpp:40
Result< void > reset(std::int32_t subdivision, float radius, std::uint32_t seed)
Replaces the map with a new sphere of 10 * 4^subdivision + 2 cells.
Definition HexSphereMap.cpp:52
void removeAll(HexMap &map, HexVisibility &visibility) noexcept
Removes every unit and clears the visibility counters of the map.
Definition HexUnits.cpp:187
Result< void > restore(HexMap &map, HexVisibility &visibility, HexSearchContext &scratch, const std::vector< HexUnitState > &states)
Replaces every unit with states, granting their vision.
Definition HexUnits.cpp:375
void reset(std::int32_t cellCount)
Sizes the counter array for cellCount cells and zeroes it.
Definition HexVisibility.cpp:34
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
ssq::Table project(HSQUIRRELVM vm, const eve::Result< void > &result)
Project a completed editing result that has no payload.
Definition EditorScriptProjection.h:28
Definition HexCell.h:9
void buildFeatureMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the urban, farm, plant and special decorations of one chunk.
Definition HexFeatures.cpp:644
constexpr std::int32_t kMaxHexGridDimension
Largest grid edge, in cells, any entry point may request.
Definition HexMap.h:47
void buildSphereWaterMesh(const HexSphereMap &map, HexMeshData &out)
Builds the ocean surface of a spherical hex map.
Definition HexSphereMesh.cpp:971
@ Feature
Urban, farm, plant and special decorations; built by buildFeatureMesh.
@ Wall
City/farm walls, wall towers and bridges; built by buildWallMesh.
void buildChunkSurfaceMesh(const HexMap &map, std::int32_t chunkIndex, HexSurface surface, HexMeshData &out)
Builds one chunk surface by dispatching on surface.
Definition HexMapMesh.cpp:5
Result< void > applyHexTerrain(HexMap &map, const HexTerrainBake &bake)
Replace a planar map's cells with a bake.
Definition HexTerrainBake.cpp:175
Result< HexTerrainBake > hexTerrainBakeFromValue(const Value &value)
Parse a script bake payload produced by hexTerrainBakeToValue.
Definition HexTerrainBake.cpp:128
constexpr std::int32_t kHexDirectionCount
Number of hex edges / facing directions.
Definition HexMetrics.h:62
void buildWallMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the wall and bridge geometry of one chunk.
Definition HexFeatures.cpp:632
constexpr HexSphereCell kNoHexSphereCell
Returned by a spherical cell query that has no answer.
Definition HexSphereTopology.h:19
Result< void > applyHexSphereTerrain(HexSphereMap &map, const HexTerrainBake &bake)
Replace a spherical map's cells with a bake.
Definition HexTerrainBake.cpp:192
std::int32_t HexSphereCell
Dense identifier of one cell of a spherical hex topology.
Definition HexSphereTopology.h:16
Result< HexPath > findPath(const HexMap &map, HexSearchContext &scratch, HexCoordinates from, HexCoordinates to, const HexMoveRules &rules, const HexOccupancyQuery &occupied)
Finds the cheapest path between two cells.
Definition HexSearch.cpp:147
void buildSphereTerrainMesh(const HexSphereMap &map, HexMeshData &out)
Builds the ground, terrace and cliff surface of a spherical hex map.
Definition HexSphereMesh.cpp:959
Result< void > loadHexMap(const std::vector< std::uint8_t > &bytes, HexMap &map, std::vector< HexUnitState > &units)
Restores a map and its units from a payload produced by saveHexMap.
Definition HexSerializer.cpp:197
void buildFogMesh(const HexMap &map, const HexVisibility &visibility, std::int32_t chunkIndex, HexMeshData &out)
Builds the fog-of-war overlay of one chunk.
Definition HexFogMesh.cpp:116
Result< void > saveHexMap(const HexMap &map, const std::vector< HexUnitState > &units, std::vector< std::uint8_t > &out)
Serializes a map and its units into a self-describing byte payload.
Definition HexSerializer.cpp:163
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:454
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.
Definition SquirrelBinding.cpp:342
WidgetDesc list(std::string listId, const std::vector< std::string > &items, const std::function< WidgetDesc(const std::string &, int)> &itemFn)
Expand a string list into a Group of item widgets. itemFn(label, index) builds each row; keys default...
Definition Widget.cpp:715
@ InvalidArgument
@ NotFound
static constexpr HexCoordinates fromOffset(std::int32_t offsetX, std::int32_t offsetZ) noexcept
Converts an odd-row offset pair into axial coordinates.
Definition HexCoordinates.h:84
Packed terrain produced by a generator and applied onto a hex map.
Definition HexTerrainBake.h:28