(World) Inlined some methods

Former-commit-id: eab086bdde8b11cc261faf2cb5d161bbfcebdc73
This commit is contained in:
Lynix
2015-02-08 17:47:41 +01:00
parent d5a8bdca12
commit 32951deed8
3 changed files with 44 additions and 38 deletions

41
SDK/include/NDK/World.inl Normal file
View File

@@ -0,0 +1,41 @@
// 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
namespace Ndk
{
inline World::World() :
m_nextIndex(0)
{
}
inline World::EntityList World::CreateEntities(unsigned int count)
{
EntityList list;
for (unsigned int i = 0; i < count; ++i)
list.push_back(CreateEntity());
return list;
}
inline void World::KillEntities(EntityList& list)
{
m_killedEntities.reserve(m_killedEntities.size() + list.size());
for (Entity& entity : list)
KillEntity(entity);
}
inline bool World::IsEntityValid(const Entity& entity) const
{
///DOC: Cette méthode vérifie également l'appartenance de l'entité au monde (et est donc plus sûre)
return entity.GetWorld() == this && IsEntityIdValid(entity.GetId());
}
inline bool World::IsEntityIdValid(Entity::Id id) const
{
///DOC: Il est possible que si l'identifiant vienne d'un autre monde, il soit considéré valide
/// alors qu'aucune entité de ce monde-ci ne l'utilise (encore)
return m_entitiesCounter[id.part.index] == id.part.counter;
}
}