diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-04-15 12:17:53 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-04-15 12:17:53 +0200 |
commit | 2ee0f834487cfe4b6bd9424ca2715685a8db16e4 (patch) | |
tree | 6867718d6bfcd42f6a82c86dd8f149d6ea6cab68 /PositionI.cpp | |
download | AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.gz AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.bz2 AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.lz AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.xz AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.zst AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.zip |
Diffstat (limited to 'PositionI.cpp')
-rw-r--r-- | PositionI.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/PositionI.cpp b/PositionI.cpp new file mode 100644 index 0000000..7180527 --- /dev/null +++ b/PositionI.cpp @@ -0,0 +1,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); +} |