Pyrogenesis  trunk
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
LongPathfinder Class Reference

#include <LongPathfinder.h>

Collaboration diagram for LongPathfinder:
Collaboration graph
[legend]

Classes

struct  Debug
 

Public Member Functions

 LongPathfinder ()
 
 ~LongPathfinder ()
 
void SetDebugOverlay (bool enabled)
 
void SetDebugPath (const HierarchicalPathfinder &hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass)
 
void Reload (Grid< NavcellData > *passabilityGrid)
 
void Update (Grid< NavcellData > *passabilityGrid)
 
void ComputePath (const HierarchicalPathfinder &hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal &origGoal, pass_class_t passClass, WaypointPath &path) const
 Compute a tile-based path from the given point to the goal, and return the set of waypoints. More...
 
void ComputePath (const HierarchicalPathfinder &hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal &origGoal, pass_class_t passClass, std::vector< CircularRegion > excludedRegions, WaypointPath &path)
 Compute a tile-based path from the given point to the goal, excluding the regions specified in excludedRegions (which are treated as impassable) and return the set of waypoints. More...
 
void GetDebugData (u32 &steps, double &time, Grid< u8 > &grid) const
 

Public Attributes

Grid< NavcellData > * m_Grid
 
u16 m_GridSize
 
struct LongPathfinder::Debug m_Debug
 

Private Member Functions

PathCost CalculateHeuristic (int i, int j, int iGoal, int jGoal) const
 
void ProcessNeighbour (int pi, int pj, int i, int j, PathCost pg, PathfinderState &state) const
 
void AddJumpedHoriz (int i, int j, int di, PathCost g, PathfinderState &state, bool detectGoal) const
 JPS algorithm helper functions. More...
 
int HasJumpedHoriz (int i, int j, int di, PathfinderState &state, bool detectGoal) const
 
void AddJumpedVert (int i, int j, int dj, PathCost g, PathfinderState &state, bool detectGoal) const
 
int HasJumpedVert (int i, int j, int dj, PathfinderState &state, bool detectGoal) const
 
void AddJumpedDiag (int i, int j, int di, int dj, PathCost g, PathfinderState &state) const
 
void ComputeJPSPath (const HierarchicalPathfinder &hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal &origGoal, pass_class_t passClass, WaypointPath &path) const
 See LongPathfinder.cpp for implementation details TODO: cleanup documentation. More...
 
void GetDebugDataJPS (u32 &steps, double &time, Grid< u8 > &grid) const
 
void ImprovePathWaypoints (WaypointPath &path, pass_class_t passClass, entity_pos_t maxDist, entity_pos_t x0, entity_pos_t z0) const
 Given a path with an arbitrary collection of waypoints, updates the waypoints to be nicer. More...
 
void GenerateSpecialMap (pass_class_t passClass, std::vector< CircularRegion > excludedRegions)
 Generate a passability map, stored in the 16th bit of navcells, based on passClass, but with a set of impassable circular regions. More...
 

Private Attributes

bool m_UseJPSCache
 
std::map< pass_class_t, std::shared_ptr< JumpPointCache > > m_JumpPointCache
 

Constructor & Destructor Documentation

◆ LongPathfinder()

LongPathfinder::LongPathfinder ( )

◆ ~LongPathfinder()

LongPathfinder::~LongPathfinder ( )

Member Function Documentation

◆ AddJumpedDiag()

void LongPathfinder::AddJumpedDiag ( int  i,
int  j,
int  di,
int  dj,
PathCost  g,
PathfinderState state 
) const
private

◆ AddJumpedHoriz()

void LongPathfinder::AddJumpedHoriz ( int  i,
int  j,
int  di,
PathCost  g,
PathfinderState state,
bool  detectGoal 
) const
private

JPS algorithm helper functions.

Parameters
detectGoalis not used if m_UseJPSCache is true

◆ AddJumpedVert()

void LongPathfinder::AddJumpedVert ( int  i,
int  j,
int  dj,
PathCost  g,
PathfinderState state,
bool  detectGoal 
) const
private

◆ CalculateHeuristic()

PathCost LongPathfinder::CalculateHeuristic ( int  i,
int  j,
int  iGoal,
int  jGoal 
) const
private

◆ ComputeJPSPath()

void LongPathfinder::ComputeJPSPath ( const HierarchicalPathfinder hierPath,
entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal origGoal,
pass_class_t  passClass,
WaypointPath path 
) const
private

See LongPathfinder.cpp for implementation details TODO: cleanup documentation.

◆ ComputePath() [1/2]

void LongPathfinder::ComputePath ( const HierarchicalPathfinder hierPath,
entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal origGoal,
pass_class_t  passClass,
WaypointPath path 
) const

Compute a tile-based path from the given point to the goal, and return the set of waypoints.

The waypoints correspond to the centers of horizontally/vertically adjacent tiles along the path.

◆ ComputePath() [2/2]

void LongPathfinder::ComputePath ( const HierarchicalPathfinder hierPath,
entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal origGoal,
pass_class_t  passClass,
std::vector< CircularRegion excludedRegions,
WaypointPath path 
)

Compute a tile-based path from the given point to the goal, excluding the regions specified in excludedRegions (which are treated as impassable) and return the set of waypoints.

The waypoints correspond to the centers of horizontally/vertically adjacent tiles along the path.

◆ GenerateSpecialMap()

void LongPathfinder::GenerateSpecialMap ( pass_class_t  passClass,
std::vector< CircularRegion excludedRegions 
)
private

Generate a passability map, stored in the 16th bit of navcells, based on passClass, but with a set of impassable circular regions.

◆ GetDebugData()

void LongPathfinder::GetDebugData ( u32 steps,
double &  time,
Grid< u8 > &  grid 
) const
inline

◆ GetDebugDataJPS()

void LongPathfinder::GetDebugDataJPS ( u32 steps,
double &  time,
Grid< u8 > &  grid 
) const
private

◆ HasJumpedHoriz()

int LongPathfinder::HasJumpedHoriz ( int  i,
int  j,
int  di,
PathfinderState state,
bool  detectGoal 
) const
private

◆ HasJumpedVert()

int LongPathfinder::HasJumpedVert ( int  i,
int  j,
int  dj,
PathfinderState state,
bool  detectGoal 
) const
private

◆ ImprovePathWaypoints()

void LongPathfinder::ImprovePathWaypoints ( WaypointPath path,
pass_class_t  passClass,
entity_pos_t  maxDist,
entity_pos_t  x0,
entity_pos_t  z0 
) const
private

Given a path with an arbitrary collection of waypoints, updates the waypoints to be nicer.

If

Parameters
maxDistis non-zero, path waypoints will be espaced by at most
maxDist.In that case the distance between (x0, z0) and the first waypoint will also be made less than maxDist.

◆ ProcessNeighbour()

void LongPathfinder::ProcessNeighbour ( int  pi,
int  pj,
int  i,
int  j,
PathCost  pg,
PathfinderState state 
) const
private

◆ Reload()

void LongPathfinder::Reload ( Grid< NavcellData > *  passabilityGrid)
inline

◆ SetDebugOverlay()

void LongPathfinder::SetDebugOverlay ( bool  enabled)

◆ SetDebugPath()

void LongPathfinder::SetDebugPath ( const HierarchicalPathfinder hierPath,
entity_pos_t  x0,
entity_pos_t  z0,
const PathGoal goal,
pass_class_t  passClass 
)
inline

◆ Update()

void LongPathfinder::Update ( Grid< NavcellData > *  passabilityGrid)
inline

Member Data Documentation

◆ m_Debug

struct LongPathfinder::Debug LongPathfinder::m_Debug

◆ m_Grid

Grid<NavcellData>* LongPathfinder::m_Grid

◆ m_GridSize

u16 LongPathfinder::m_GridSize

◆ m_JumpPointCache

std::map<pass_class_t, std::shared_ptr<JumpPointCache> > LongPathfinder::m_JumpPointCache
mutableprivate

◆ m_UseJPSCache

bool LongPathfinder::m_UseJPSCache
private

The documentation for this class was generated from the following files: