blob: deb6040c61a1a2445a88448b7fe721b20ad65ee1 (
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
|
#include <algorithm>
#include "Pathfinder.h"
#include "Museum.h"
using namespace std;
Pathfinder::Pathfinder(Museum & m) : museum(m) {
}
void Pathfinder::set_visited(const XY & point) {
this->visisted[point.y * this->museum.canvas.data.columns + point.x] = true;
}
bool Pathfinder::is_visited(const XY & point) {
size_t idx = point.y * this->museum.canvas.data.columns + point.x;
if (idx >= this->visisted.size()) return false;
return this->visisted[idx];
}
void Pathfinder::clear() {
CanvasData & canvas = this->museum.canvas.data;
this->visisted.resize(canvas.columns * canvas.rows);
fill(this->visisted.begin(), this->visisted.end(), false);
}
|