aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--entityx/Entity.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/entityx/Entity.h b/entityx/Entity.h
index 6e82a5a..3f96628 100644
--- a/entityx/Entity.h
+++ b/entityx/Entity.h
@@ -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();
};
@@ -527,6 +522,13 @@ class EntityManager : boost::noncopyable {
};
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);
}