24 #include "../CD_LIB/CDGrid.h"
28 namespace OpenSkyNet {
61 #pragma warning(disable:4100) //unreferenced formal parameter
74 std::vector<AStarNode*> _heap;
81 for ( ; (hole_ << 1) <= _currSize; hole_ = child) {
83 if ((child != _currSize) && (*(_heap[child+1]) < *(_heap[child])))
85 if (*(_heap[child]) < *tmp)
86 _heap[hole_] = _heap[child];
97 if (++_currSize == _heap.size())
98 _heap.resize(_currSize << 1,0);
100 for (hole = _currSize; (hole > 1) && (*node_ < *(_heap[hole >> 1])); hole = hole >> 1)
101 _heap[hole] = _heap[hole >> 1];
108 _heap[1] = _heap[_currSize--];
117 inline bool isEmpty()
const {
return !_currSize; }
129 successor_->
_g = curr_->
_g + 1.73205f;
130 successor_->
_h = sqrtf(static_cast<float>((targBin_ - successor_->
_bin).getLenSqrd()));
131 successor_->
_f = successor_->
_g + successor_->
_h;
140 successor_->
_g = curr_->
_g + 1.41421f;
141 successor_->
_h = sqrtf(static_cast<float>((targBin_ - successor_->
_bin).getLenSqrd()));
142 successor_->
_f = successor_->
_g + successor_->
_h;
152 successor_->
_g = curr_->
_g + 1.0f;
153 successor_->
_h = sqrtf(static_cast<float>((targBin_ - successor_->
_bin).getLenSqrd()));
154 successor_->
_f = successor_->
_g + successor_->
_h;
167 float successorG = curr_->
_g + prevPathBinDist_;
169 successor_->
_g = successorG;
170 successor_->
_h = sqrtf(static_cast<float>((targBin_ - successor_->
_bin).getLenSqrd()));
171 successor_->
_f = successor_->
_g + successor_->
_h;
179 void getDirsOrPaths(AStarNode* curr_, std::vector<DirOrPath>& dirsOrPaths_)
const;
CD::DIRECTION _prevDir
Definition: PFAStar.h:46
const Utils::uint MAX_X_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:72
AStarNode(const Math::Point< int > &bin_)
Definition: PFAStar.h:53
const Math::Point< int > & _bin
Definition: PFAStar.h:50
~PriorityQueue()
Definition: PFAStar.cpp:21
void removeMin(AStarNode *&min_)
Definition: PFAStar.h:106
User editable constants to finetune the pathfinder's capabilities.
float _g
Definition: PFAStar.h:51
bool operator<(const AStarNode &rhs_) const
Definition: PFAStar.h:57
float getMinGCost(Math::Point< int > bin_) const
Definition: PFAStar.h:119
bool _isFromWPC
Definition: PFAStar.h:45
Utils::uint getCompositeKey(const Math::Point< Utils::uint > &bin_)
Definition: CDGrid.h:41
CD::DIRECTION _dir
Definition: PFAStar.h:35
DIRECTION
Definition: CDGrid.h:61
Math::Path _path
Definition: PFAStar.h:36
AStarNode * _parent
Definition: PFAStar.h:44
PriorityQueue()
Definition: PFAStar.cpp:16
DirOrPath(CD::DIRECTION dir_)
Definition: PFAStar.h:38
void insert(AStarNode *node_)
Definition: PFAStar.h:96
Utils::HashTableUIntKeys< AStarNode * > _nodes
Definition: PFAStar.h:72
void processSuccessor(AStarNode *curr_, AStarNode *successor_, const Math::Point< int > &targBin_, CD::DIRECTION prevDir_)
Definition: PFAStar.h:123
void init(const Math::Point< int > &bin_)
Definition: PFAStar.cpp:32
float _h
Definition: PFAStar.h:51
DirOrPath(const Math::Path &path_)
Definition: PFAStar.h:39
float _f
Definition: PFAStar.h:51
unsigned int uint
Definition: UTypes.h:39
bool _isDir
Definition: PFAStar.h:34
void add(const uint &key_, const T &value_)
Definition: UHash.h:185
const Utils::uint MAX_Z_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:78
bool isEmpty() const
Definition: PFAStar.h:117
DirOrPath()
Definition: PFAStar.h:37
const Utils::uint MAX_Y_DIVISIONS_FOR_ALL_GRIDS
Definition: CDGrid.h:75
void getDirsOrPaths(AStarNode *curr_, std::vector< DirOrPath > &dirsOrPaths_) const
Definition: PFAStar.cpp:54