From 266da016ad5736f66919b7ed2c0ecf1f405fd929 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 8 Feb 2015 15:45:42 +0100 Subject: [PATCH] (World) Added clear method Former-commit-id: 54789542144a382c134042fa8050d06d3a80ca5d --- SDK/include/NDK/World.hpp | 2 ++ SDK/src/NDK/World.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/SDK/include/NDK/World.hpp b/SDK/include/NDK/World.hpp index 232edceb1..d8bba2536 100644 --- a/SDK/include/NDK/World.hpp +++ b/SDK/include/NDK/World.hpp @@ -25,6 +25,8 @@ namespace Ndk Entity CreateEntity(); EntityList CreateEntities(unsigned int count); + void Clear(); + void KillEntity(Entity& entity); void KillEntities(EntityList& list); diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 75159ddaa..8f313a966 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -50,6 +50,19 @@ namespace Ndk return list; } + void World::Clear() + { + ///DOC: Les handles existants avant Clear ne sont plus garantis de ne pas être réutilisés + /// et devraient être détruits avant la création d'une nouvelle entité. + + m_aliveEntities.clear(); + m_entitiesCounter.clear(); + m_freeIdList.clear(); + m_killedEntities.clear(); + + m_nextIndex = 0; + } + void World::KillEntity(Entity& entity) { if (IsEntityValid(entity))