载入中...
搜索中...
未找到
HexSearch.h
浏览该文件的文档.
157[[nodiscard]] EVENGINE_API_WORLD bool isValidDestination(const HexMap& map, HexCoordinates coordinates,
174[[nodiscard]] EVENGINE_API_WORLD std::int32_t moveCost(const HexMap& map, HexCoordinates from, HexCoordinates to,
207[[nodiscard]] EVENGINE_API_WORLD Result<HexPath> findPath(const HexMap& map, HexSearchContext& scratch,
228[[nodiscard]] Result<void> collectVisibleCells(const HexMap& map, HexSearchContext& scratch, HexCoordinates from,
Editable hex cell grid: topology, queries, picking and authoring.
Move-only, checked operation results for the common layer.
Reusable search scratch: one record per cell plus a priority bucket queue.
Definition HexSearch.h:68
std::int32_t cellCount() const noexcept
Number of cells this context can hold.
Definition HexSearch.h:80
Definition HexCell.h:9
std::int32_t moveCost(const HexMap &map, HexCoordinates from, HexCoordinates to, HexDirection direction, const HexOccupancyQuery &occupied)
Cost of moving between two adjacent cells.
Definition HexSearch.cpp:131
std::function< bool(HexCoordinates)> HexOccupancyQuery
Predicate answering whether a cell is already occupied by another actor.
Definition HexSearch.h:143
bool isValidDestination(const HexMap &map, HexCoordinates coordinates, const HexOccupancyQuery &occupied)
Whether an actor may occupy a cell.
Definition HexSearch.cpp:121
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
Result< void > collectVisibleCells(const HexMap &map, HexSearchContext &scratch, HexCoordinates from, std::int32_t range, std::vector< std::int32_t > &out)
Collects every cell visible from from within range.
Definition HexSearch.cpp:250
Definition Container.h:602
Movement tuning of one actor; cells per turn and vision radius in cells.
Definition HexSearch.h:130
std::int32_t visionRange
Vision radius in cells, added to the cell's own view elevation.
Definition HexSearch.h:134
One found path: the cells from origin to goal, with the turn each one is reached on.
Definition HexSearch.h:178
std::size_t size() const noexcept
Number of cells on the path, inclusive of both ends.
Definition HexSearch.h:187
std::vector< std::int32_t > cells
Linear cell indices, cells.front() is the origin and cells.back() the goal.
Definition HexSearch.h:180
std::vector< std::int32_t > turns
Turn index for each entry of cells; parallel to cells.
Definition HexSearch.h:182
std::int32_t nextWithSamePriority
Next cell index sharing this record's priority bucket, or -1.
Definition HexSearch.h:33
std::int32_t priority() const noexcept
Ordering key of the priority queue (distance + heuristic).
Definition HexSearch.h:36
std::int32_t distance
Shortest distance from the search origin found so far.
Definition HexSearch.h:25
std::int32_t searchPhase
Phase this record was written in; a record from an older phase is unvisited.
Definition HexSearch.h:31
std::int32_t heuristic
Remaining-distance estimate towards the search goal (0 for blind searches).
Definition HexSearch.h:29