More fixes in Map::findPath
Fixed the styling, std::unique and removed the priority_queue comment
This commit is contained in:
parent
43524a9127
commit
ff617c3fab
|
@ -697,7 +697,6 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
|||
}
|
||||
|
||||
std::unordered_map<Position, Node*, PositionHasher> nodes;
|
||||
//std::priority_queue<Node*, std::vector<Node*>, LessNode> searchList;
|
||||
std::deque<Node*> searchList;
|
||||
|
||||
Node *currentNode = new Node(startPos);
|
||||
|
@ -798,11 +797,12 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
|||
}
|
||||
|
||||
std::sort(searchList.begin(), searchList.end(), [](Node *a, Node *b) { return a->totalCost < b->totalCost; });
|
||||
std::unique(searchList.begin(), searchList.end());
|
||||
auto end = std::unique(searchList.begin(), searchList.end());
|
||||
searchList.resize(std::distance(searchList.begin(), end));
|
||||
|
||||
currentNode->evaluated = true;
|
||||
currentNode = nullptr;
|
||||
while(searchList.size() > 0 && !currentNode) {
|
||||
while(!searchList.empty() && !currentNode) {
|
||||
Node *node = searchList.front();
|
||||
searchList.pop_front();
|
||||
|
||||
|
|
Loading…
Reference in New Issue