]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
Make Component<T>::family() support > 64 components.
authorAlec Thomas <alec@swapoff.org>
Fri, 15 Mar 2013 03:26:47 +0000 (23:26 -0400)
committerAlec Thomas <alec@swapoff.org>
Fri, 15 Mar 2013 03:26:47 +0000 (23:26 -0400)
entityx/Entity.h

index 6e82a5a25e591d9029847e035f43b8430d1383c4..3f96628e80e99b83525aafa7611b57cb09c124ab 100644 (file)
@@ -158,12 +158,7 @@ template <typename Derived>
 struct Component : public BaseComponent {
  public:
   /// Used internally for registration.
-  static Family family() {
-    static Family family = family_counter_++;
-    // The 64-bit bitmask supports a maximum of 64 components.
-    assert(family < 64);
-    return family;
-  }
+  static Family family();
 };
 
 
@@ -526,6 +521,13 @@ class EntityManager : boost::noncopyable {
   std::list<Entity::Id> free_list_;
 };
 
+template <typename C>
+static BaseComponent::Family Component<C>::family() {
+  static Family family = family_counter_++;
+  assert(family < EntityManager::MAX_COMPONENTS);
+  return family;
+}
+
 template <typename C>
 boost::shared_ptr<C> Entity::assign(boost::shared_ptr<C> component) {
   return manager_->assign<C>(id_, component);