载入中...
搜索中...
未找到
eve::map::Pathfinder类 参考

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.

在文件 Pathfinder.cpp 第 383 行定义.

◆ Pathfinder() [2/5]

eve::map::Pathfinder::Pathfinder ( TileLayer *  layer)
explicit

Pathfinder.

在文件 Pathfinder.cpp 第 385 行定义.

引用了 bindLayer() , 以及 layer.

◆ Pathfinder() [3/5]

eve::map::Pathfinder::Pathfinder ( int  width,
int  height 
)
explicit

Pathfinder.

在文件 Pathfinder.cpp 第 387 行定义.

引用了 height, setSize() , 以及 width.

◆ ~Pathfinder()

eve::map::Pathfinder::~Pathfinder ( )
default

◆ Pathfinder() [4/5]

eve::map::Pathfinder::Pathfinder ( Pathfinder &&  )
defaultnoexcept

◆ Pathfinder() [5/5]

eve::map::Pathfinder::Pathfinder ( const Pathfinder &  )
delete

成员函数说明

◆ bindLayer()

void eve::map::Pathfinder::bindLayer ( TileLayer *  layer)

Binds layer.

在文件 Pathfinder.cpp 第 398 行定义.

引用了 invalidateCache() , 以及 layer.

被这些函数引用 Pathfinder().

◆ blockGid()

void eve::map::Pathfinder::blockGid ( int  gid)

Block gid.

在文件 Pathfinder.cpp 第 423 行定义.

引用了 invalidateCache().

◆ 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 ( )

Clears blocked gids.

在文件 Pathfinder.cpp 第 433 行定义.

引用了 invalidateCache().

◆ 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 行定义.

引用了 sx , 以及 sy.

◆ 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 行定义.

引用了 sx , 以及 sy.

被这些函数引用 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.

参数
sxStart cell x.
syStart cell y.
gxGoal cell x.
gyGoal cell y.
entryPenaltyAdditional 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.
参数
entryPenaltyFloat.

在文件 Pathfinder.cpp 第 639 行定义.

引用了 cx, cy, found, idx, n, nx, ny, parent, path, start, sx, sy, w, x , 以及 y.

◆ followFlow()

Path * eve::map::Pathfinder::followFlow ( FlowField *  field,
int  sx,
int  sy 
)

Follow flow.

Trace path along a flow field from start. Owned Path*.

在文件 Pathfinder.cpp 第 730 行定义.

引用了 nx, ny, path, step, sx, sy, x , 以及 y.

◆ 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

Returns the cell cost.

在文件 Pathfinder.cpp 第 457 行定义.

引用了 x , 以及 y.

◆ getDiagonal()

bool eve::map::Pathfinder::getDiagonal ( ) const

Returns the diagonal.

在文件 Pathfinder.cpp 第 421 行定义.

◆ getNavigationChangeStamp()

NavigationChangeStamp eve::map::Pathfinder::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.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

◆ 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.

参数
sxSpawn / start cell x.
sySpawn / start cell y.
gxGoal / exit cell x.
gyGoal / exit cell y.
blockXTemporary block cell x.
blockYTemporary block cell y.
返回
true when 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 行定义.

引用了 sx , 以及 sy.

◆ 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).

参数
footprintWPositive footprint width in cells.
footprintHPositive footprint height in cells.
返回
true when 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]

Pathfinder & eve::map::Pathfinder::operator= ( const Pathfinder &  )
delete

◆ operator=() [2/2]

Pathfinder & eve::map::Pathfinder::operator= ( Pathfinder &&  )
defaultnoexcept

Operator =.

◆ setBlocked()

void eve::map::Pathfinder::setBlocked ( int  x,
int  y,
bool  blocked 
)

Sets the blocked.

在文件 Pathfinder.cpp 第 445 行定义.

引用了 invalidateCache(), x , 以及 y.

◆ setBlockEmpty()

void eve::map::Pathfinder::setBlockEmpty ( bool  enable)

Sets the block empty.

在文件 Pathfinder.cpp 第 438 行定义.

引用了 invalidateCache().

◆ setCellCost()

void eve::map::Pathfinder::setCellCost ( int  x,
int  y,
float  cost 
)

Sets the cell cost.

在文件 Pathfinder.cpp 第 452 行定义.

引用了 cost, invalidateCache(), x , 以及 y.

◆ setDiagonal()

void eve::map::Pathfinder::setDiagonal ( bool  enable)

Sets the diagonal.

在文件 Pathfinder.cpp 第 416 行定义.

引用了 invalidateCache().

◆ 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)

Sets the topology.

在文件 Pathfinder.cpp 第 409 行定义.

引用了 invalidateCache() , 以及 name.

◆ syncFromLayer()

void eve::map::Pathfinder::syncFromLayer ( )

Synchronizes from layer.

在文件 Pathfinder.cpp 第 459 行定义.

引用了 invalidateCache().

◆ unblockGid()

void eve::map::Pathfinder::unblockGid ( int  gid)

Unblock gid.

在文件 Pathfinder.cpp 第 428 行定义.

引用了 invalidateCache().


该类的文档由以下文件生成: