载入中...
搜索中...
未找到
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.
 
 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.

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

◆ Pathfinder() [2/5]

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

Pathfinder.

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

引用了 bindLayer() , 以及 layer.

◆ Pathfinder() [3/5]

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

Pathfinder.

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

引用了 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 第 360 行定义.

引用了 bindLayer() , 以及 layer.

被这些函数引用 bindLayer() , 以及 Pathfinder().

◆ blockGid()

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

Block gid.

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

引用了 invalidateCache().

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

Clears blocked gids.

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

引用了 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 第 622 行定义.

引用了 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 第 493 行定义.

引用了 sx , 以及 sy.

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

参数
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 第 497 行定义.

引用了 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 第 588 行定义.

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

◆ 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

Returns the cell cost.

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

引用了 x , 以及 y.

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

引用了 x , 以及 y.

被这些函数引用 eve::rts::systems_internal::isFormationSegmentClear(), eve::rts::SupplyRendezvousSystem::select() , 以及 eve::rts::ArtilleryRelocationSystem::select().

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

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

◆ setBlockEmpty()

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

Sets the block empty.

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

引用了 invalidateCache().

◆ setCellCost()

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

Sets the cell cost.

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

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

◆ setDiagonal()

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

Sets the diagonal.

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

引用了 invalidateCache().

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

Sets the topology.

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

引用了 invalidateCache() , 以及 name.

◆ syncFromLayer()

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

Synchronizes from layer.

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

引用了 invalidateCache().

◆ unblockGid()

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

Unblock gid.

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

引用了 invalidateCache().


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