cleanup
This commit is contained in:
2
TODO
2
TODO
@@ -8,8 +8,6 @@
|
||||
* custom (decoupled) pools ==> N-buffering, shared components, multi-model, hibitsets, and so on
|
||||
* add examples (and credits) from @alanjfs :)
|
||||
* static reflection, hint: template<> meta_type_t<Type>: meta_descriptor<name, func..., props..., etc...> (see #342)
|
||||
* add meta support to registry (eg entity for each component and opaque get)
|
||||
* allow for custom stamp functions
|
||||
* observer: user defined filters (eg .replace<T, &function> or .group<T, U, &func>)
|
||||
* use underlying_type as entity type within pools and registry? it would make different registries work together flawlessy
|
||||
* can we write a bool conv func for entt::entity that silently compares it to null?
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <memory>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include "../config/config.h"
|
||||
#include "../core/type_info.hpp"
|
||||
@@ -84,10 +83,8 @@ class dispatcher {
|
||||
static_assert(std::is_same_v<Event, std::decay_t<Event>>);
|
||||
static std::size_t index{pools.size()};
|
||||
|
||||
if(!(index < pools.size()) || pools[index]->type_id() != type_info<Event>::id()) {
|
||||
index = std::find_if(pools.cbegin(), pools.cend(), [](auto &&cpool) {
|
||||
return cpool->type_id() == type_info<Event>::id();
|
||||
}) - pools.cbegin();
|
||||
if(const auto length = pools.size(); !(index < length) || pools[index]->type_id() != type_info<Event>::id()) {
|
||||
for(index = {}; index < length && pools[index]->type_id() != type_info<Event>::id(); ++index);
|
||||
|
||||
if(index == pools.size()) {
|
||||
pools.push_back(std::make_unique<pool_handler<Event>>());
|
||||
@@ -189,9 +186,9 @@ public:
|
||||
template<typename... Event>
|
||||
void clear() {
|
||||
if constexpr(sizeof...(Event) == 0) {
|
||||
std::for_each(pools.begin(), pools.end(), [](auto &&cpool) {
|
||||
for(auto &&cpool: pools) {
|
||||
cpool->clear();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
(assure<Event>().clear(), ...);
|
||||
}
|
||||
|
||||
@@ -123,10 +123,8 @@ class emitter {
|
||||
static_assert(std::is_same_v<Event, std::decay_t<Event>>);
|
||||
static std::size_t index{pools.size()};
|
||||
|
||||
if(!(index < pools.size()) || pools[index]->type_id() != type_info<Event>::id()) {
|
||||
index = std::find_if(pools.cbegin(), pools.cend(), [](auto &&cpool) {
|
||||
return cpool->type_id() == type_info<Event>::id();
|
||||
}) - pools.cbegin();
|
||||
if(const auto length = pools.size(); !(index < length) || pools[index]->type_id() != type_info<Event>::id()) {
|
||||
for(index = {}; index < length && pools[index]->type_id() != type_info<Event>::id(); ++index);
|
||||
|
||||
if(index == pools.size()) {
|
||||
pools.push_back(std::make_unique<pool_handler<Event>>());
|
||||
|
||||
Reference in New Issue
Block a user