Remade Entities

Former-commit-id: 25f7bc84279fdf58b44cf78e2d94b4cbb78a8410
This commit is contained in:
Lynix
2015-02-19 22:06:57 +01:00
parent 1d79efeb7f
commit 3a18035989
8 changed files with 361 additions and 107 deletions

View File

@@ -6,15 +6,9 @@
namespace Ndk
{
inline Entity::Entity() :
m_world(nullptr)
{
m_id.value = 0;
}
inline Entity::Entity(Id id, World* world) :
inline Entity::Entity(World& world, Id id) :
m_id(id),
m_world(world)
m_world(&world)
{
}
@@ -28,23 +22,13 @@ namespace Ndk
return m_world;
}
inline bool Entity::operator==(const Entity& other) const
inline void Entity::RegisterHandle(EntityHandle* handle)
{
return m_world == other.m_world && m_id == other.m_id;
m_handles.insert(handle);
}
inline bool Entity::operator!=(const Entity& other) const
inline void Entity::UnregisterHandle(EntityHandle* handle)
{
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);
m_handles.erase(handle);
}
}