Documentation for module 'NDK'
Former-commit-id: 63e1cac538c577a1f1aafa71fa7eef69a6d4daab [formerly b2d8769fd02a0e7d9c476d4ad7be1988a1fd6789] [formerly 636b5cb79bcb8da44d9aa45ba1023565bcf29f0d [formerly a2361ec2b8679d4d4ba096e543b5d4b91825dd62]] Former-commit-id: d402d35477f9db0135c553d55c401939426bf62d [formerly 607336ea0f42731e4604f3a8c2df06f3aecfc401] Former-commit-id: 69e23cd6c06723486de5e4641ce810012dac66da
This commit is contained in:
@@ -7,22 +7,54 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \ingroup NDK
|
||||
* \class Ndk::EntityList
|
||||
* \brief NDK class that represents a set of entities to help performing batch operations
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Clears the set from every entities
|
||||
*/
|
||||
|
||||
inline void EntityList::Clear()
|
||||
{
|
||||
m_entities.clear();
|
||||
m_entityBits.Clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether or not the set contains the entity
|
||||
* \return true If it is the case
|
||||
*
|
||||
* \param entity Pointer to the entity
|
||||
*/
|
||||
|
||||
inline bool EntityList::Has(const Entity* entity)
|
||||
{
|
||||
return entity && entity->IsValid() && Has(entity->GetId());
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether or not the set contains the entity by id
|
||||
* \return true If it is the case
|
||||
*
|
||||
* \param id Identifier of the entity
|
||||
*/
|
||||
|
||||
inline bool EntityList::Has(EntityId entity)
|
||||
{
|
||||
return m_entityBits.UnboundedTest(entity);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Inserts the entity into the set
|
||||
*
|
||||
* \param entity Pointer to the entity
|
||||
*
|
||||
* \remark If entity is already contained, no action is performed
|
||||
*/
|
||||
|
||||
inline void EntityList::Insert(Entity* entity)
|
||||
{
|
||||
if (!Has(entity))
|
||||
@@ -32,6 +64,14 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Removes the entity from the set
|
||||
*
|
||||
* \param entity Pointer to the entity
|
||||
*
|
||||
* \remark If entity is not contained, no action is performed
|
||||
*/
|
||||
|
||||
inline void EntityList::Remove(Entity* entity)
|
||||
{
|
||||
if (Has(entity))
|
||||
@@ -40,7 +80,7 @@ namespace Ndk
|
||||
NazaraAssert(it != m_entities.end(), "Entity should be part of the vector");
|
||||
|
||||
std::swap(*it, m_entities.back());
|
||||
m_entities.pop_back(); // On le sort du vector
|
||||
m_entities.pop_back(); // We get it out of the vector
|
||||
m_entityBits.UnboundedSet(entity->GetId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user