Fix ecs::dispatcher to work with ecs::without
This commit is contained in:
parent
bd202d08ae
commit
37a3d7f827
1 changed files with 18 additions and 24 deletions
|
|
@ -48,30 +48,24 @@ namespace psemek::ecs
|
||||||
handlers_[Event::uuid()].push_back([system = std::move(system), this, cache = container_->cache<Components...>()](void const * event_ptr) mutable {
|
handlers_[Event::uuid()].push_back([system = std::move(system), this, cache = container_->cache<Components...>()](void const * event_ptr) mutable {
|
||||||
auto const & event = *reinterpret_cast<Event const *>(event_ptr);
|
auto const & event = *reinterpret_cast<Event const *>(event_ptr);
|
||||||
|
|
||||||
if constexpr (std::invocable<System, Event const &, ecs::container &, handle, Components & ...>)
|
container_->apply<Components...>([&]<typename ... FilteredComponents>(ecs::container & container, ecs::handle entity, FilteredComponents & ... filtered_components){
|
||||||
{
|
if constexpr (std::invocable<System, Event const &, ecs::container &, handle, FilteredComponents & ...>)
|
||||||
container_->apply<Components...>([&](ecs::container & container, ecs::handle handle, Components & ... components){
|
{
|
||||||
system(event, container, handle, components...);
|
system(event, container, entity, filtered_components...);
|
||||||
}, cache);
|
}
|
||||||
}
|
else if constexpr (std::invocable<System, Event const &, ecs::container &, FilteredComponents & ...>)
|
||||||
else if constexpr (std::invocable<System, Event const &, ecs::container &, Components & ...>)
|
{
|
||||||
{
|
system(event, container, filtered_components...);
|
||||||
container_->apply<Components...>([&](ecs::container & container, Components & ... components){
|
}
|
||||||
system(event, container, components...);
|
else if constexpr (std::invocable<System, Event const &, handle, FilteredComponents & ...>)
|
||||||
}, cache);
|
{
|
||||||
}
|
system(event, entity, filtered_components...);
|
||||||
else if constexpr (std::invocable<System, Event const &, handle, Components & ...>)
|
}
|
||||||
{
|
else
|
||||||
container_->apply<Components...>([&](ecs::handle handle, Components & ... components){
|
{
|
||||||
system(event, handle, components...);
|
system(event, filtered_components...);
|
||||||
}, cache);
|
}
|
||||||
}
|
});
|
||||||
else
|
|
||||||
{
|
|
||||||
container_->apply<Components...>([&](Components & ... components){
|
|
||||||
system(event, components...);
|
|
||||||
}, cache);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue