diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-29 23:13:25 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-29 23:13:25 +0200 |
commit | 00febf68ad8bc36546c02b0c0b926189fb3955a1 (patch) | |
tree | c10896365ce99cd0e22f9398908b094ea5114e9e /src/Mobs/MobPointer.cpp | |
parent | Agressives wander and don't crash (diff) | |
download | cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar.gz cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar.bz2 cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar.lz cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar.xz cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.tar.zst cuberite-00febf68ad8bc36546c02b0c0b926189fb3955a1.zip |
Diffstat (limited to 'src/Mobs/MobPointer.cpp')
-rw-r--r-- | src/Mobs/MobPointer.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/Mobs/MobPointer.cpp b/src/Mobs/MobPointer.cpp new file mode 100644 index 000000000..b755e3cdf --- /dev/null +++ b/src/Mobs/MobPointer.cpp @@ -0,0 +1,75 @@ +#include "../Entities/Pawn.h" +#include "MobPointer.h" + +cMobPointer::cMobPointer(cPawn * a_Pointer) : m_Pointer(a_Pointer) +{ + // Constructor +} + + + + + +cMobPointer::cMobPointer(const cMobPointer & a_MobPointer) : m_Pointer(a_MobPointer.m_Pointer) +{ + // Copy constructor +} + + + + + +cMobPointer::cMobPointer(cMobPointer && a_MobPointer) +{ + // move Constructor + m_Pointer = a_MobPointer.m_Pointer; + a_MobPointer.m_Pointer = nullptr; +} + + + + + +cMobPointer& cMobPointer::operator=(const cMobPointer& a_MobPointer) +{ + // Copy assignment operator + m_Pointer = a_MobPointer.m_Pointer; + return *this; +} + + + + + +cMobPointer& cMobPointer::operator=(cMobPointer&& a_MobPointer) +{ + // Move assignment operator + m_Pointer = a_MobPointer.m_Pointer; + a_MobPointer.m_Pointer = nullptr; + return *this; +} + + + + + +void cMobPointer::operator=(cPawn * a_Pointer) +{ + m_Pointer = a_Pointer; +} + + + + + +cPawn * cMobPointer::GetPointer() +{ + if (m_Pointer != nullptr) + { + if (!m_Pointer->IsTicking()) + { + m_Pointer = nullptr; + } + } + return m_Pointer; +} |