33 LCostNode::LCostNode() : _gCost(0), _hCost(0), _fCost(0),
34 _parent( std::pair<int,int>(0,0) )
51 _pq=std::priority_queue<Cost>();
62 _pq=std::priority_queue<Cost>();
76 while (! ((curPos.first ==
_to.
getX()) && (curPos.second ==
_to.
getY()))
81 DEBTRACE(
"curPos(" << curPos.first <<
"," << curPos.second <<
")");
95 aPath.push_front(
_to);
101 aPath.push_front(current);
111 LNodeMap::const_iterator it = aList.find(
n);
112 if (it == aList.end())
121 int x = currentNode.first;
122 int y = currentNode.second;
123 for (
int i = x-1;
i <= x+1;
i++)
127 for (
int j = y-1; j <= y+1; j++)
132 if ((
i == x) && (j == y))
135 if ((
i != x) && (j != y))
142 pair<int,int> pos(
i,j);
168 std::pair<int, int> pos;
174 while(aList.count(pos)==0);
182 DEBTRACE(
"node not in open list, can't delete");
bool isEqual(const LNode &o) const
std::pair< int, int > getPos() const
const LinkMatrix & _linkMatrix
LinkAStar(const LinkMatrix &linkMatrix)
bool computePath(LNode from, LNode to)
std::pair< int, int > bestNode(const LNodeMap &aList)
bool isAlreadyInList(std::pair< int, int > n, const LNodeMap &aList)
void moveToClosedList(std::pair< int, int > n)
void addNeighbours(std::pair< int, int > n)
std::priority_queue< Cost > _pq
double distance(int i1, int j1, int i2, int j2)
int cost(int i, int j) const
std::list< LNode > LNodePath
std::map< std::pair< int, int >, LCostNode > LNodeMap