blob: d02d9cb2bbd9b8cb9818d0f350e1c285aac9d6d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#pragma once
#include <unordered_map>
#include "Pathfinder.h"
class DijkstraPathfinder : public Pathfinder {
using Pathfinder::Pathfinder;
public:
virtual void find_between(const XY &, const XY &);
virtual const Path & get_path();
protected:
virtual void clear();
private:
Path solution;
XY end;
struct Node {
XY parent;
unsigned int cost = -1;
};
Node & map_get(const XY &);
std::unordered_map<XY, Node> map;
void explore(const XY &, unsigned int cost = 0);
};
|