diff options
Diffstat (limited to 'src/Mobs/MobPointer.cpp')
-rw-r--r-- | src/Mobs/MobPointer.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/Mobs/MobPointer.cpp b/src/Mobs/MobPointer.cpp new file mode 100644 index 000000000..8fb64867d --- /dev/null +++ b/src/Mobs/MobPointer.cpp @@ -0,0 +1,78 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "../Entities/Pawn.h" +#include "MobPointer.h" +#include "../World.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::SetPointer(cPawn * a_Pointer) +{ + m_Pointer = a_Pointer; +} + + + + + +cPawn * cMobPointer::GetPointer(cWorld * a_CurrentWorld) +{ + if (m_Pointer != nullptr) + { + if (!m_Pointer->IsTicking() || (m_Pointer->GetWorld() != a_CurrentWorld)) + { + m_Pointer = nullptr; + } + } + return m_Pointer; +} |