aboutsummaryrefslogtreecommitdiff
path: root/PathfindingContext.h
blob: bb6fc23c013aea6d6f51a2aa3a556f697f87bcc1 (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
#pragma once

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

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

class Museum;

class PathfindingContext {
public:
	PathfindingContext(Museum &);

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; }
	bool empty_point(const XY & point);

  void update();

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;

private:
	XY start_point = { -1, -1 };
	XY end_point = { -1, -1 };

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

private:
	Museum & museum;
};