]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
Revert "Trigger ComponentRemovedEvent for each component before destroying"
authorZack Mulgrew <zmulgrew@linkedin.com>
Fri, 26 Feb 2016 14:26:13 +0000 (06:26 -0800)
committerZack Mulgrew <zmulgrew@linkedin.com>
Sat, 27 Feb 2016 23:32:04 +0000 (15:32 -0800)
This reverts commit 070cd89d2ed140594608d252318f444202579a52.

entityx/Entity.h
entityx/EntityClass.h
entityx/help/Pool.h
entityx/help/Pool_test.cc

index 2ef01f77d01fb38cd27028e9719aa3374327f04e..8e1e93e60e152f97dd687c62beaa6fae21d1130f 100644 (file)
@@ -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<EntityDestroyedEvent>(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<EntityDestroyedEvent>(Entity(this, entity));
     entity_component_mask_[index].reset();
     entity_version_[index]++;
     free_list_.push_back(index);
index 94a2a02ee024574529d6e7aab2667620da1959f7..444e4948b7e4de1cbb80b568bb61c4ca4159d601 100644 (file)
@@ -10,7 +10,6 @@
 
 #pragma once
 
-#include <bitset>
 #include "entityx/config.h"
 
 namespace entityx {
index c4b7d83d1c3c86e95c92de570521763bda208540..f217ec25b0bb3f1fbd4af7e4ff21482f674b7561 100644 (file)
@@ -14,8 +14,6 @@
 #include <cassert>
 #include <vector>
 
-#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<char *> blocks_;
@@ -93,10 +90,6 @@ class Pool : public BasePool {
     T *ptr = static_cast<T*>(get(n));
     ptr->~T();
   }
-
-  virtual void removeComponent(Entity entity) override {
-    entity.remove<T>();
-  }
 };
 
 }  // namespace entityx
index 1092068f4644c008ce9fb9d7efdaa886e092d4c5..56ca85af346e15829e13a030d1fa0d8382e28957 100644 (file)
@@ -13,7 +13,6 @@
 #include <vector>
 #include "entityx/3rdparty/catch.hpp"
 #include "entityx/help/Pool.h"
-#include "entityx/Entity.h"
 
 struct Position {
   explicit Position(int *ptr = nullptr) : ptr(ptr) {