aboutsummaryrefslogtreecommitdiff
path: root/PathfindingContext.h
blob: aae02cd882e254d9c8887504e9270d1939a04c07 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include <memory>
#include <unordered_map>
#include <vector>

#include "XY.h"
#include "Pathfinder.h"

class Museum;

class PathfindingContext {
public:
	PathfindingContext(Museum &);
	void update();

private:
	XY start_point = { -1, -1 };
	XY end_point = { -1, -1 };
public:
	void set_start(const XY & point);
	const XY & get_start() { return this->start_point; }
	void set_end(const XY & point);
	const XY & get_end() { return this->end_point; }
public:
	bool empty_point(const XY & point);

public:
	void register_weight(const std::string & type, unsigned int weight);
	unsigned int get_weight(const std::string & type);
private:
	std::unordered_map<std::string, unsigned int> weight_map;

public:
	Pathfinder & get_solver();
	void cycle_solver();
private:
	std::vector<std::unique_ptr<Pathfinder>> solvers;
	size_t solver_index = 0;

public:
	bool has_collision = false;

private:
	Museum & museum;
};