aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Thomas <alec@swapoff.org>2013-03-14 23:26:47 -0400
committerAlec Thomas <alec@swapoff.org>2013-03-14 23:26:47 -0400
commit26864aaf41dc4465595eed597db9f5588a30a268 (patch)
tree4ca30ab61f5e8f2c85b67161c6fb03283bef62a0
parenta17e47baa3f39b27d26efb2da118d5d8cf9bf091 (diff)
Make Component<T>::family() support > 64 components.
-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);
}