-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeMap.h
More file actions
45 lines (40 loc) · 1.11 KB
/
NodeMap.h
File metadata and controls
45 lines (40 loc) · 1.11 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include"Node.h"
#include<iostream>
#include<map>
#include<memory>
#include<iomanip>
#include<vector>
#include<queue>
using namespace std;
class Node;
template<class T>
struct PrioQueueAscending {
bool operator()(const T &lhs, const T &rhs)const {
return (lhs->GetDistanceCost() > rhs->GetDistanceCost());
}
};
class NodeMap
{
public:
map<int, map<int, shared_ptr<Node>>> NodeMapContainer;
vector<shared_ptr<Node>> VisitedNodes;
vector<Node*> Path;
priority_queue<shared_ptr<Node>,vector<shared_ptr<Node>>, PrioQueueAscending<shared_ptr<Node>>> ScannedNodes;
shared_ptr<bool> endNodeFound = make_unique<bool>(false);
shared_ptr<bool> startNodeFound = make_unique<bool>(false);
shared_ptr<Node> StartNode;
shared_ptr<Node> EndNode;
void DisplayMap()const;
void ClearInput();
static NodeMap& GetInstance(size_t size); // ensures only one instance possible
void PlaceNode(shared_ptr<Node> &nodeToPlace);
void TracePath();
void Pathfind();
void TurnPathIntoWall();
void TestMap();
private:
NodeMap(const size_t size);
~NodeMap();
const size_t MapSize;
};