Files
NazaraEngine/SDK/include/NDK/World.inl
Lynix 6201183572 (World) Replaced pointers to Entity by EntityHandle
Former-commit-id: b29aaaa7362c0c816dc270e15ba5f8253717c457
2015-02-19 23:51:17 +01:00

35 lines
893 B
C++

// 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::EntityList World::CreateEntities(unsigned int count)
{
EntityList list;
list.reserve(count);
for (unsigned int i = 0; i < count; ++i)
list.emplace_back(CreateEntity());
return list;
}
inline void World::KillEntities(const EntityList& list)
{
m_killedEntities.reserve(m_killedEntities.size() + list.size());
for (const EntityHandle& entity : list)
KillEntity(entity);
}
inline bool World::IsEntityValid(EntityHandle entity) const
{
return entity.IsValid() && entity->GetWorld() == this && IsEntityIdValid(entity->GetId());
}
inline bool World::IsEntityIdValid(Entity::Id id) const
{
return id < m_entities.size() && m_entities[id].IsValid();
}
}