summaryrefslogtreecommitdiffstats
path: root/PositionI.cpp
blob: 71805275168faf342fa33ef6e8cfcf7533482752 (plain) (blame)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "PositionI.hpp"

PositionI::PositionI(int x, int z, int y) : m_x(x), m_y(y), m_z(z) {

}

PositionI::~PositionI() {

}

int PositionI::GetX() const {
    return m_x;
}

int PositionI::GetY() const {
    return m_y;
}

int PositionI::GetZ() const {
    return m_z;
}

void PositionI::SetX(int x) {
    m_x = x;
}

void PositionI::SetY(int y) {
    m_y = y;
}

void PositionI::setZ(int z) {
    m_z = z;
}

bool PositionI::operator==(const PositionI &other) const {
    return other.m_x == m_x && other.m_z == m_z && other.m_y == other.m_y;
}

PositionI &PositionI::operator=(const PositionI &other) {
    m_y = other.m_y;
    m_z = other.m_z;
    m_x = other.m_x;
    return *this;
}

PositionI::PositionI(const PositionI &other) {
    m_y = other.m_y;
    m_z = other.m_z;
    m_x = other.m_x;
}

PositionI::PositionI() : m_x(0), m_y(0), m_z(0) {

}

bool PositionI::operator<(const PositionI &rhs) const {
    if (m_x < rhs.m_x)
        return true;
    if (rhs.m_x < m_x)
        return false;
    if (m_y < rhs.m_y)
        return true;
    if (rhs.m_y < m_y)
        return false;
    return m_z < rhs.m_z;
}

bool PositionI::operator>(const PositionI &rhs) const {
    return rhs < *this;
}

bool PositionI::operator<=(const PositionI &rhs) const {
    return !(rhs < *this);
}

bool PositionI::operator>=(const PositionI &rhs) const {
    return !(*this < rhs);
}