Pathfinding facade. Single-agent: A*. Group (same goal): Flow Field + follow. Grid/topology internals stay out of the public ABI (Windows export limit). 更多...
#include <Pathfinder.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| Pathfinder () | |
| Pathfinder. | |
| Pathfinder (TileLayer *layer) | |
| Pathfinder. | |
| Pathfinder (int width, int height) | |
| Pathfinder. | |
| ~Pathfinder () | |
| Pathfinder. | |
| Result< NavigationGridSnapshot > | captureNavigationGrid () |
| Capture canonical grid inputs into immutable owned storage, without mutating the live grid. | |
| NavigationChangeStamp | getNavigationChangeStamp () const noexcept |
| Read an O(1) invalidation hint without copying/synchronizing the grid. @ownership Borrows the already attached layer during this call; it must remain alive. @thread Map owner thread only. @reentrancy No callbacks. | |
| Pathfinder (Pathfinder &&) noexcept | |
| Pathfinder. | |
| Pathfinder & | operator= (Pathfinder &&) noexcept |
| Operator =. | |
| Pathfinder (const Pathfinder &)=delete | |
| Pathfinder & | operator= (const Pathfinder &)=delete |
| void | bindLayer (TileLayer *layer) |
| Binds layer. | |
| void | setSize (int width, int height) |
| Sets the size. | |
| void | setTopology (const std::string &name) |
| Sets the topology. | |
| std::string | getTopology () const |
| Returns the topology. | |
| void | setDiagonal (bool enable) |
| Sets the diagonal. | |
| bool | getDiagonal () const |
| Returns the diagonal. | |
| void | blockGid (int gid) |
| Block gid. | |
| void | unblockGid (int gid) |
| Unblock gid. | |
| void | clearBlockedGids () |
| Clears blocked gids. | |
| void | setBlockEmpty (bool enable) |
| Sets the block empty. | |
| bool | getBlockEmpty () const |
| Returns the block empty. | |
| void | setBlocked (int x, int y, bool blocked) |
| Sets the blocked. | |
| bool | isWalkable (int x, int y) const |
| True when walkable. | |
| void | setCellCost (int x, int y, float cost) |
| Sets the cell cost. | |
| float | getCellCost (int x, int y) const |
| Returns the cell cost. | |
| void | syncFromLayer () |
| Synchronizes from layer. | |
| Path * | findPath (int sx, int sy, int gx, int gy) |
| A* from (sx,sy) to (gx,gy). Returns owned Path* (may be empty if unreachable). Never returns nullptr — always a Path object for simpler script null checks via length. | |
| Path * | findPath (int sx, int sy, int gx, int gy, const std::function< float(int, int)> &entryPenalty) |
| A* with a caller-owned non-negative dynamic entry penalty. | |
| Result< bool > | keepsPathOpen (int sx, int sy, int gx, int gy, int blockX, int blockY) |
| Probe whether spawn→goal stays reachable after temporarily sealing cells. | |
| Result< bool > | keepsPathOpenFootprint (int sx, int sy, int gx, int gy, int originX, int originY, int footprintW, int footprintH) |
| Same as keepsPathOpen for an axis-aligned footprint origin+(w,h). | |
| FlowField * | buildFlowField (int gx, int gy) |
| Build / reuse cached flow field toward goal. Owned by caller. | |
| Path * | followFlow (FlowField *field, int sx, int sy) |
| Follow flow. | |
| Path * | findGroupPath (int sx, int sy, int gx, int gy) |
| Group helper: ensure field for goal, then follow from start. Equivalent to buildFlowField + followFlow but reuses internal cache when possible. | |
| void | invalidateCache () |
| Invalidate cached flow field (also called when grid dirties). | |
详细描述
Pathfinding facade. Single-agent: A*. Group (same goal): Flow Field + follow. Grid/topology internals stay out of the public ABI (Windows export limit).
在文件 Pathfinder.h 第 62 行定义.
构造及析构函数说明
◆ Pathfinder() [1/5]
| eve::map::Pathfinder::Pathfinder | ( | ) |
在文件 Pathfinder.cpp 第 383 行定义.
◆ Pathfinder() [2/5]
|
explicit |
◆ Pathfinder() [3/5]
|
explicit |
◆ ~Pathfinder()
|
default |
◆ Pathfinder() [4/5]
|
defaultnoexcept |
◆ Pathfinder() [5/5]
|
delete |
成员函数说明
◆ bindLayer()
| void eve::map::Pathfinder::bindLayer | ( | TileLayer * | layer | ) |
◆ blockGid()
| void eve::map::Pathfinder::blockGid | ( | int | gid | ) |
◆ buildFlowField()
| FlowField * eve::map::Pathfinder::buildFlowField | ( | int | gx, |
| int | gy | ||
| ) |
Build / reuse cached flow field toward goal. Owned by caller.
在文件 Pathfinder.cpp 第 704 行定义.
◆ captureNavigationGrid()
| Result< NavigationGridSnapshot > eve::map::Pathfinder::captureNavigationGrid | ( | ) |
Capture canonical grid inputs into immutable owned storage, without mutating the live grid.
- 返回
- Opaque snapshot; unchanged content shares the prior immutable capture and revision. @ownership Retains no provider/layer pointers; a bound layer must remain alive during this call. @thread Map owner thread only. @reentrancy No callbacks. @cost Copies and compares grid-sized inputs; amortize at explicit navigation projection boundaries.
在文件 Pathfinder.cpp 第 534 行定义.
引用了 axisY, eve::Conflict, cost, count, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::NoOp, eve::PreconditionViolation, previous, result, eve::Status::success(), eve::Result< T >::success() , 以及 topology.
◆ clearBlockedGids()
| void eve::map::Pathfinder::clearBlockedGids | ( | ) |
◆ findGroupPath()
| Path * eve::map::Pathfinder::findGroupPath | ( | int | sx, |
| int | sy, | ||
| int | gx, | ||
| int | gy | ||
| ) |
Group helper: ensure field for goal, then follow from start. Equivalent to buildFlowField + followFlow but reuses internal cache when possible.
在文件 Pathfinder.cpp 第 764 行定义.
◆ findPath() [1/2]
| Path * eve::map::Pathfinder::findPath | ( | int | sx, |
| int | sy, | ||
| int | gx, | ||
| int | gy | ||
| ) |
A* from (sx,sy) to (gx,gy). Returns owned Path* (may be empty if unreachable). Never returns nullptr — always a Path object for simpler script null checks via length.
在文件 Pathfinder.cpp 第 582 行定义.
被这些函数引用 eve::rts::SupplyRendezvousSystem::select() , 以及 eve::rts::ArtilleryRelocationSystem::select().
◆ findPath() [2/2]
| Path * eve::map::Pathfinder::findPath | ( | int | sx, |
| int | sy, | ||
| int | gx, | ||
| int | gy, | ||
| const std::function< float(int, int)> & | entryPenalty | ||
| ) |
A* with a caller-owned non-negative dynamic entry penalty.
- 参数
-
sx Start cell x. sy Start cell y. gx Goal cell x. gy Goal cell y. entryPenalty Additional cost for entering a walkable cell. Negative values are clamped to zero; non-finite values reject that cell.
- 返回
- Caller-owned path, empty when no route satisfies the overlay. @ownership Ownership transfers to the caller, which must release the Path after its final synchronous use. @lifetime The returned Path remains valid until the caller releases it and does not borrow Pathfinder state.
- 参数
-
entryPenalty Float.
在文件 Pathfinder.cpp 第 639 行定义.
引用了 cx, cy, found, idx, n, nx, ny, parent, path, start, sx, sy, w, x , 以及 y.
◆ followFlow()
◆ getBlockEmpty()
| bool eve::map::Pathfinder::getBlockEmpty | ( | ) | const |
Returns the block empty.
在文件 Pathfinder.cpp 第 443 行定义.
◆ getCellCost()
| float eve::map::Pathfinder::getCellCost | ( | int | x, |
| int | y | ||
| ) | const |
◆ getDiagonal()
| bool eve::map::Pathfinder::getDiagonal | ( | ) | const |
Returns the diagonal.
在文件 Pathfinder.cpp 第 421 行定义.
◆ getNavigationChangeStamp()
|
noexcept |
Read an O(1) invalidation hint without copying/synchronizing the grid. @ownership Borrows the already attached layer during this call; it must remain alive. @thread Map owner thread only. @reentrancy No callbacks.
在文件 Pathfinder.cpp 第 393 行定义.
引用了 layer.
◆ getTopology()
| std::string eve::map::Pathfinder::getTopology | ( | ) | const |
Returns the topology.
在文件 Pathfinder.cpp 第 414 行定义.
◆ invalidateCache()
| void eve::map::Pathfinder::invalidateCache | ( | ) |
Invalidate cached flow field (also called when grid dirties).
在文件 Pathfinder.cpp 第 464 行定义.
被这些函数引用 bindLayer(), blockGid(), clearBlockedGids(), setBlocked(), setBlockEmpty(), setCellCost(), setDiagonal(), setSize(), setTopology(), syncFromLayer() , 以及 unblockGid().
◆ isWalkable()
| bool eve::map::Pathfinder::isWalkable | ( | int | x, |
| int | y | ||
| ) | const |
True when walkable.
在文件 Pathfinder.cpp 第 450 行定义.
被这些函数引用 eve::rts::systems_internal::isFormationSegmentClear(), eve::rts::SupplyRendezvousSystem::select(), eve::rts::ArtilleryRelocationSystem::select() , 以及 eve::rts::TrafficReservationSystem::step().
◆ keepsPathOpen()
| Result< bool > eve::map::Pathfinder::keepsPathOpen | ( | int | sx, |
| int | sy, | ||
| int | gx, | ||
| int | gy, | ||
| int | blockX, | ||
| int | blockY | ||
| ) |
Probe whether spawn→goal stays reachable after temporarily sealing cells.
- 参数
-
sx Spawn / start cell x. sy Spawn / start cell y. gx Goal / exit cell x. gy Goal / exit cell y. blockX Temporary block cell x. blockY Temporary block cell y.
- 返回
truewhen a route still exists; does not mutate the live grid.
- 备注
- Blocking the spawn or goal cell itself always returns false. Already unwalkable probe cells are ignored. Uses the entry-penalty overlay so flow-field caches stay untouched. @cost One A* probe amortized over the temporary block set. @thread Map owner / simulation thread; no callbacks.
在文件 Pathfinder.cpp 第 619 行定义.
◆ keepsPathOpenFootprint()
| Result< bool > eve::map::Pathfinder::keepsPathOpenFootprint | ( | int | sx, |
| int | sy, | ||
| int | gx, | ||
| int | gy, | ||
| int | originX, | ||
| int | originY, | ||
| int | footprintW, | ||
| int | footprintH | ||
| ) |
Same as keepsPathOpen for an axis-aligned footprint origin+(w,h).
- 参数
-
footprintW Positive footprint width in cells. footprintH Positive footprint height in cells.
- 返回
truewhen spawn→goal stays reachable after sealing the footprint. @cost One A* probe; footprint cells outside the grid are rejected.
在文件 Pathfinder.cpp 第 625 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, sx, sy, x , 以及 y.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
defaultnoexcept |
Operator =.
◆ setBlocked()
| void eve::map::Pathfinder::setBlocked | ( | int | x, |
| int | y, | ||
| bool | blocked | ||
| ) |
◆ setBlockEmpty()
| void eve::map::Pathfinder::setBlockEmpty | ( | bool | enable | ) |
◆ setCellCost()
| void eve::map::Pathfinder::setCellCost | ( | int | x, |
| int | y, | ||
| float | cost | ||
| ) |
◆ setDiagonal()
| void eve::map::Pathfinder::setDiagonal | ( | bool | enable | ) |
◆ setSize()
| void eve::map::Pathfinder::setSize | ( | int | width, |
| int | height | ||
| ) |
Sets the size.
在文件 Pathfinder.cpp 第 403 行定义.
引用了 height, invalidateCache() , 以及 width.
被这些函数引用 Pathfinder().
◆ setTopology()
| void eve::map::Pathfinder::setTopology | ( | const std::string & | name | ) |
◆ syncFromLayer()
| void eve::map::Pathfinder::syncFromLayer | ( | ) |
◆ unblockGid()
| void eve::map::Pathfinder::unblockGid | ( | int | gid | ) |
该类的文档由以下文件生成:
- src/modules/map/Pathfinder.h
- src/modules/map/Pathfinder.cpp