Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
HierarchicalPathfinder::Chunk Struct Reference

Public Member Functions

 cassert (CHUNK_SIZE *CHUNK_SIZE/2< 65536)
 
void InitRegions (int ci, int cj, Grid< NavcellData > *grid, pass_class_t passClass)
 
RegionID Get (int i, int j) const
 Returns a RegionID for the given global navcell coords (which must be inside this chunk);. More...
 
void RegionCenter (u16 r, int &i, int &j) const
 Return the global navcell coords that correspond roughly to the center of the given region in this chunk. More...
 
void RegionNavcellNearest (u16 r, int iGoal, int jGoal, int &iBest, int &jBest, u32 &dist2Best) const
 Returns the global navcell coords, and the squared distance to the goal navcell, of whichever navcell inside the given region is closest to that goal. More...
 
bool RegionNearestNavcellInGoal (u16 r, u16 i0, u16 j0, const PathGoal &goal, u16 &iOut, u16 &jOut, u32 &dist2Best) const
 Gives the global navcell coords, and the squared distance to the (i0,j0) navcell, of whichever navcell inside the given region and inside the given goal is closest to (i0,j0) Returns true if the goal is inside the region, false otherwise. More...
 

Public Attributes

u8 m_ChunkI
 
u8 m_ChunkJ
 
std::vector< u16m_RegionsID
 
u16 m_Regions [CHUNK_SIZE][CHUNK_SIZE]
 

Member Function Documentation

◆ cassert()

HierarchicalPathfinder::Chunk::cassert ( )

◆ Get()

HierarchicalPathfinder::RegionID HierarchicalPathfinder::Chunk::Get ( int  i,
int  j 
) const

Returns a RegionID for the given global navcell coords (which must be inside this chunk);.

◆ InitRegions()

void HierarchicalPathfinder::Chunk::InitRegions ( int  ci,
int  cj,
Grid< NavcellData > *  grid,
pass_class_t  passClass 
)

◆ RegionCenter()

void HierarchicalPathfinder::Chunk::RegionCenter ( u16  r,
int &  i_out,
int &  j_out 
) const

Return the global navcell coords that correspond roughly to the center of the given region in this chunk.

(This is not guaranteed to be actually inside the region.)

◆ RegionNavcellNearest()

void HierarchicalPathfinder::Chunk::RegionNavcellNearest ( u16  r,
int  iGoal,
int  jGoal,
int &  iBest,
int &  jBest,
u32 dist2Best 
) const

Returns the global navcell coords, and the squared distance to the goal navcell, of whichever navcell inside the given region is closest to that goal.

◆ RegionNearestNavcellInGoal()

bool HierarchicalPathfinder::Chunk::RegionNearestNavcellInGoal ( u16  r,
u16  i0,
u16  j0,
const PathGoal goal,
u16 iOut,
u16 jOut,
u32 dist2Best 
) const

Gives the global navcell coords, and the squared distance to the (i0,j0) navcell, of whichever navcell inside the given region and inside the given goal is closest to (i0,j0) Returns true if the goal is inside the region, false otherwise.

Member Data Documentation

◆ m_ChunkI

u8 HierarchicalPathfinder::Chunk::m_ChunkI

◆ m_ChunkJ

u8 HierarchicalPathfinder::Chunk::m_ChunkJ

◆ m_Regions

u16 HierarchicalPathfinder::Chunk::m_Regions[CHUNK_SIZE][CHUNK_SIZE]

◆ m_RegionsID

std::vector<u16> HierarchicalPathfinder::Chunk::m_RegionsID

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