diff --git a/SDK/include/NDK/Entity.hpp b/SDK/include/NDK/Entity.hpp index 91a88ef50..73214fb40 100644 --- a/SDK/include/NDK/Entity.hpp +++ b/SDK/include/NDK/Entity.hpp @@ -50,15 +50,8 @@ namespace Ndk nzUInt64 value; }; - bool operator==(const Id& other) const - { - return value == other.value; - } - - bool operator!=(const Id& other) const - { - return !operator==(other); - } + bool operator==(const Id& other) const; + bool operator!=(const Id& other) const; }; private: @@ -69,4 +62,6 @@ namespace Ndk }; } +#include + #endif // NDK_ENTITY_HPP diff --git a/SDK/include/NDK/Entity.inl b/SDK/include/NDK/Entity.inl new file mode 100644 index 000000000..0a27680e0 --- /dev/null +++ b/SDK/include/NDK/Entity.inl @@ -0,0 +1,50 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Development Kit" +// For conditions of distribution and use, see copyright notice in Prerequesites.hpp + +#include + +namespace Ndk +{ + inline Entity::Entity() : + m_world(nullptr) + { + m_id.value = 0; + } + + inline Entity::Entity(Id id, World* world) : + m_id(id), + m_world(world) + { + } + + inline Entity::Id Entity::GetId() const + { + return m_id; + } + + inline World* Entity::GetWorld() const + { + return m_world; + } + + inline bool Entity::operator==(const Entity& other) const + { + return m_world == other.m_world && m_id == other.m_id; + } + + inline bool Entity::operator!=(const Entity& other) const + { + return !operator==(other); + } + + inline bool Entity::Id::operator==(const Id& other) const + { + return value == other.value; + } + + inline bool Entity::Id::operator!=(const Id& other) const + { + return !operator==(other); + } +} diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index f25763fc5..21f9c6bd8 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -5,45 +5,13 @@ namespace Ndk { - Entity::Entity() : - m_world(nullptr) - { - m_id.value = 0; - } - - Entity::Entity(Id id, World* world) : - m_id(id), - m_world(world) - { - } - void Entity::Kill() { m_world->KillEntity(*this); } - Entity::Id Entity::GetId() const - { - return m_id; - } - - World* Entity::GetWorld() const - { - return m_world; - } - bool Entity::IsValid() const { return m_world != nullptr && m_world->IsEntityIdValid(m_id); } - - bool Entity::operator==(const Entity& other) const - { - return m_world == other.m_world && m_id == other.m_id; - } - - bool Entity::operator!=(const Entity& other) const - { - return !operator==(other); - } }