-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coordinate.cpp
60 lines (49 loc) · 1.02 KB
/
Coordinate.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "Coordinate.hpp"
Coordinate::Coordinate(unsigned int x, unsigned int y)
: x(x), y(y)
{
}
Coordinate::Coordinate(unsigned int x, unsigned int y, bool walkable)
: x(x), y(y), walkable(walkable)
{
}
unsigned int Coordinate::getX()
{
return x;
}
unsigned int Coordinate::getY()
{
return y;
}
bool Coordinate::isWalkable() const
{
return walkable;
}
void Coordinate::initialize(unsigned int x, unsigned int y, bool walkable)
{
this->x = x;
this->y = y;
this->walkable = walkable;
}
bool Coordinate::isUsedPath() const
{
return usedPath;
}
void Coordinate::setUsedPath(bool usedPath)
{
Coordinate::usedPath = usedPath;
}
bool Coordinate::operator==(const Coordinate &rhs) const
{
return x == rhs.x &&
y == rhs.y;
}
bool Coordinate::operator!=(const Coordinate &rhs) const
{
return !(rhs == *this);
}
std::ostream &operator<<(std::ostream &os, const Coordinate &coordinate)
{
os << "x: " << coordinate.x << " y: " << coordinate.y << "\n";
return os;
}