From 0b2ec179c6ce75fd6accaa84c6131f980622b257 Mon Sep 17 00:00:00 2001 From: Zack Mulgrew Date: Fri, 26 Feb 2016 06:26:13 -0800 Subject: Revert "Trigger ComponentRemovedEvent for each component before destroying" This reverts commit 070cd89d2ed140594608d252318f444202579a52. --- entityx/Entity.h | 6 ++---- entityx/EntityClass.h | 1 - entityx/help/Pool.h | 7 ------- entityx/help/Pool_test.cc | 1 - 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/entityx/Entity.h b/entityx/Entity.h index 2ef01f7..8e1e93e 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -381,14 +381,12 @@ class EntityManager : entityx::help::NonCopyable { assert_valid(entity); uint32_t index = entity.index(); auto mask = entity_component_mask_[entity.index()]; + event_manager_.emit(Entity(this, entity)); for (size_t i = 0; i < component_pools_.size(); i++) { BasePool *pool = component_pools_[i]; - if (pool && mask.test(i)) { - pool->removeComponent(Entity(this, entity)); + if (pool && mask.test(i)) pool->destroy(index); - } } - event_manager_.emit(Entity(this, entity)); entity_component_mask_[index].reset(); entity_version_[index]++; free_list_.push_back(index); diff --git a/entityx/EntityClass.h b/entityx/EntityClass.h index 94a2a02..444e494 100644 --- a/entityx/EntityClass.h +++ b/entityx/EntityClass.h @@ -10,7 +10,6 @@ #pragma once -#include #include "entityx/config.h" namespace entityx { diff --git a/entityx/help/Pool.h b/entityx/help/Pool.h index c4b7d83..f217ec2 100644 --- a/entityx/help/Pool.h +++ b/entityx/help/Pool.h @@ -14,8 +14,6 @@ #include #include -#include "entityx/EntityClass.h" - namespace entityx { /** @@ -65,7 +63,6 @@ class BasePool { } virtual void destroy(std::size_t n) = 0; - virtual void removeComponent(Entity entity) = 0; protected: std::vector blocks_; @@ -93,10 +90,6 @@ class Pool : public BasePool { T *ptr = static_cast(get(n)); ptr->~T(); } - - virtual void removeComponent(Entity entity) override { - entity.remove(); - } }; } // namespace entityx diff --git a/entityx/help/Pool_test.cc b/entityx/help/Pool_test.cc index 1092068..56ca85a 100644 --- a/entityx/help/Pool_test.cc +++ b/entityx/help/Pool_test.cc @@ -13,7 +13,6 @@ #include #include "entityx/3rdparty/catch.hpp" #include "entityx/help/Pool.h" -#include "entityx/Entity.h" struct Position { explicit Position(int *ptr = nullptr) : ptr(ptr) { -- cgit v1.2.3