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. | |
| 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. | |
| 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 第 20 行定义.
构造及析构函数说明
◆ Pathfinder() [1/5]
| eve::map::Pathfinder::Pathfinder | ( | ) |
在文件 Pathfinder.cpp 第 350 行定义.
◆ 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 | ) |
Binds layer.
在文件 Pathfinder.cpp 第 360 行定义.
引用了 bindLayer() , 以及 layer.
被这些函数引用 bindLayer() , 以及 Pathfinder().
◆ 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 第 562 行定义.
◆ 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 第 622 行定义.
◆ 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 第 493 行定义.
被这些函数引用 eve::rts::SupplyRendezvousSystem::select(), eve::rts::ArtilleryRelocationSystem::select() , 以及 eve::rts::NavigationSystem::step().
◆ 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 第 497 行定义.
引用了 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 第 405 行定义.
◆ getCellCost()
| float eve::map::Pathfinder::getCellCost | ( | int | x, |
| int | y | ||
| ) | const |
◆ getDiagonal()
| bool eve::map::Pathfinder::getDiagonal | ( | ) | const |
Returns the diagonal.
在文件 Pathfinder.cpp 第 383 行定义.
◆ getTopology()
| std::string eve::map::Pathfinder::getTopology | ( | ) | const |
Returns the topology.
在文件 Pathfinder.cpp 第 376 行定义.
◆ invalidateCache()
| void eve::map::Pathfinder::invalidateCache | ( | ) |
Invalidate cached flow field (also called when grid dirties).
在文件 Pathfinder.cpp 第 426 行定义.
被这些函数引用 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 第 412 行定义.
被这些函数引用 eve::rts::systems_internal::isFormationSegmentClear(), eve::rts::SupplyRendezvousSystem::select() , 以及 eve::rts::ArtilleryRelocationSystem::select().
◆ 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 第 365 行定义.
引用了 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