diff options
-rw-r--r-- | entityx/Entity.cc | 4 | ||||
-rw-r--r-- | entityx/Entity.h | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/entityx/Entity.cc b/entityx/Entity.cc index 89a83f7..6c43a06 100644 --- a/entityx/Entity.cc +++ b/entityx/Entity.cc @@ -15,4 +15,8 @@ namespace entityx { BaseComponent::Family BaseComponent::family_counter_ = 0; +bool Entity::exists() const { + return entities_.exists(id_); +} + } diff --git a/entityx/Entity.h b/entityx/Entity.h index e763214..6d046c3 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -42,6 +42,8 @@ class Entity { operator Id () { return id_; } + bool exists() const; + template <typename C> boost::shared_ptr<C> assign(boost::shared_ptr<C> component); template <typename C, typename ... Args> @@ -328,6 +330,10 @@ class EntityManager : boost::noncopyable { return free_list_.find(entity) == free_list_.end(); } + Entity get(Entity::Id id) { + return Entity(*this, id); + } + /** * Assigns a previously constructed Component to an Entity::Id. * |