(Entity) Inlined most code
Former-commit-id: 287c7c557263497ba89451dd2d640fcd8522ef3a
This commit is contained in:
parent
5fb728d0be
commit
d5a8bdca12
|
|
@ -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 <NDK/Entity.inl>
|
||||
|
||||
#endif // NDK_ENTITY_HPP
|
||||
|
|
|
|||
|
|
@ -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 <NDK/World.hpp>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue