* Gets the node with the least cost. * After this call, the node is no longer in the set. It is an error to call this when the set is empty. * @return A pointer to the node which had the least cost. */
| 55 | * @return A pointer to the node which had the least cost. |
| 56 | */ |
| 57 | PathfindingNode *PathfindingOpenSet::pop() |
| 58 | { |
| 59 | assert(!empty()); |
| 60 | OpenSetEntry *entry = _queue.top(); |
| 61 | PathfindingNode *nd = entry->_node; |
| 62 | _queue.pop(); |
| 63 | delete entry; |
| 64 | nd->_openentry = 0; |
| 65 | |
| 66 | // Discarded entries might be visible now. |
| 67 | removeDiscarded(); |
| 68 | return nd; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Places the node in the set. |
no test coverage detected