18 #ifndef INCLUDED_LONGPATHFINDER 19 #define INCLUDED_LONGPATHFINDER 70 STATUS_UNEXPLORED = 0,
75 bool IsUnexplored()
const {
return GetStatus() == STATUS_UNEXPLORED; }
76 bool IsOpen()
const {
return GetStatus() == STATUS_OPEN; }
77 bool IsClosed()
const {
return GetStatus() == STATUS_CLOSED; }
82 inline int GetPredI(
int i)
const {
return i + GetPredDI(); }
83 inline int GetPredJ(
int j)
const {
return j + GetPredDJ(); }
107 return (
i32)data >> 17;
112 return ((
i32)data << 15) >> 17;
120 ASSERT(-16384 <= di && di < 16384);
121 ASSERT(-16384 <= dj && dj < 16384);
123 data |= (((
u32)di & 0x7FFF) << 17) | (((
u32)dj & 0x7FFF) << 2);
170 void SetDebugOverlay(
bool enabled);
174 if (!m_Debug.Overlay)
180 ComputePath(hierPath, x0, z0, goal, passClass, *m_Debug.Path);
181 m_Debug.PassClass = passClass;
186 m_Grid = passabilityGrid;
188 m_GridSize = passabilityGrid->
m_W;
190 m_JumpPointCache.clear();
195 m_Grid = passabilityGrid;
197 ASSERT(m_GridSize == passabilityGrid->
m_H);
199 m_JumpPointCache.clear();
221 GetDebugDataJPS(steps, time, grid);
231 std::atomic<LongOverlay*> Overlay =
nullptr;
244 PathCost CalculateHeuristic(
int i,
int j,
int iGoal,
int jGoal)
const;
262 void GetDebugDataJPS(
u32& steps,
double& time,
Grid<u8>& grid)
const;
278 void GenerateSpecialMap(
pass_class_t passClass, std::vector<CircularRegion> excludedRegions);
288 #endif // INCLUDED_LONGPATHFINDER Represents the 2D coordinates of a tile.
Definition: LongPathfinder.h:38
A simple fixed-point number class.
Definition: Fixed.h:119
CircularRegion(entity_pos_t x, entity_pos_t z, entity_pos_t r)
Definition: LongPathfinder.h:129
PathGoal Goal
Definition: LongPathfinder.h:237
Similar to Grid, except optimised for sparse usage (the grid is subdivided into buckets whose content...
Definition: Grid.h:310
u16 pass_class_t
Definition: Pathfinding.h:27
bool m_UseJPSCache
Definition: LongPathfinder.h:280
double Time
Definition: LongPathfinder.h:236
Returned path.
Definition: Pathfinding.h:66
u32 data
Definition: LongPathfinder.h:90
uint16_t u16
Definition: types.h:38
u32 data
Definition: LongPathfinder.h:59
u16 j() const
Definition: LongPathfinder.h:56
bool IsUnexplored() const
Definition: LongPathfinder.h:75
u16 m_H
Definition: Grid.h:249
u16 jBest
Definition: LongPathfinder.h:155
PathCost hBest
Definition: LongPathfinder.h:154
int GetPredDJ() const
Definition: LongPathfinder.h:110
Pathfinder goal.
Definition: PathGoal.h:32
#define ASSERT(expr)
same as ENSURE in debug mode, does nothing in release mode.
Definition: debug.h:318
int GetPredI(int i) const
Definition: LongPathfinder.h:82
uint8_t u8
Definition: types.h:37
u32 steps
Definition: LongPathfinder.h:140
void SetDebugPath(const HierarchicalPathfinder &hierPath, entity_pos_t x0, entity_pos_t z0, const PathGoal &goal, pass_class_t passClass)
Definition: LongPathfinder.h:172
Jump point cache.
Definition: LongPathfinder.cpp:64
Definition: LongPathfinder.h:164
int GetPredDI() const
Definition: LongPathfinder.h:105
void Update(Grid< NavcellData > *passabilityGrid)
Definition: LongPathfinder.h:193
uint32_t u32
Definition: types.h:39
u16 i() const
Definition: LongPathfinder.h:55
bool operator<(const TileID &b) const
Returns lexicographic order over (i,j)
Definition: LongPathfinder.h:50
Definition: HierarchicalPathfinder.h:60
void SetStatusOpen()
Definition: LongPathfinder.h:78
PathCost g
Definition: LongPathfinder.h:89
int GetPredJ(int j) const
Definition: LongPathfinder.h:83
Definition: LongPathfinder.h:138
TileID()
Definition: LongPathfinder.h:40
void SetStatus(u8 s)
Definition: LongPathfinder.h:98
TileID(u16 i, u16 j)
Definition: LongPathfinder.h:42
#define SAFE_DELETE(p)
delete memory ensuing from new and set the pointer to zero (thus making double-frees safe / a no-op) ...
Definition: code_generation.h:111
pass_class_t passClass
Definition: LongPathfinder.h:146
Tile data for A* computation.
Definition: LongPathfinder.h:66
bool IsClosed() const
Definition: LongPathfinder.h:77
void Reload(Grid< NavcellData > *passabilityGrid)
Definition: LongPathfinder.h:184
Terrain overlay for pathfinder debugging.
Definition: LongPathfinder.cpp:1057
int32_t i32
Definition: types.h:34
void GetDebugData(u32 &steps, double &time, Grid< u8 > &grid) const
Definition: LongPathfinder.h:219
u16 m_GridSize
Definition: LongPathfinder.h:225
SparseGrid< PathfindTile > PathfindTileGrid
Definition: LongPathfinder.h:134
u32 Steps
Definition: LongPathfinder.h:235
PathfindTileGrid * tiles
Definition: LongPathfinder.h:151
Definition: LongPathfinder.h:228
PathGoal goal
Definition: LongPathfinder.h:142
void SetStatusClosed()
Definition: LongPathfinder.h:79
Grid< NavcellData > * m_Grid
Definition: LongPathfinder.h:224
const JumpPointCache * jpc
Definition: LongPathfinder.h:157
PathCost GetCost() const
Definition: LongPathfinder.h:85
Definition: LongPathfinder.h:127
PriorityQueue open
Definition: LongPathfinder.h:148
u8 GetStatus() const
Definition: LongPathfinder.h:93
pass_class_t PassClass
Definition: LongPathfinder.h:240
u16 m_W
Definition: Grid.h:249
void SetCost(PathCost cost)
Definition: LongPathfinder.h:86
Represents the cost of a path consisting of horizontal/vertical and diagonal movements over a uniform...
Definition: Pathfinding.h:76
Grid< NavcellData > * terrain
Definition: LongPathfinder.h:152
bool operator==(const TileID &b) const
Definition: LongPathfinder.h:44
u16 jGoal
Definition: LongPathfinder.h:144
void SetPred(int pi, int pj, int i, int j)
Definition: LongPathfinder.h:116
std::map< pass_class_t, std::shared_ptr< JumpPointCache > > m_JumpPointCache
Definition: LongPathfinder.h:285
bool IsOpen() const
Definition: LongPathfinder.h:76
entity_pos_t z
Definition: LongPathfinder.h:130
PriorityQueueHeap< TileID, PathCost, PathCost > PriorityQueue
Definition: LongPathfinder.h:133