Allow non-const constructors, destructors, and finally callbacks in ecs::container
All checks were successful
Run tests / Run tests (push) Successful in 7m6s
All checks were successful
Run tests / Run tests (push) Successful in 7m6s
This commit is contained in:
parent
091c467d2b
commit
1f7d9e278f
1 changed files with 9 additions and 6 deletions
|
|
@ -726,9 +726,10 @@ namespace psemek::ecs
|
||||||
|
|
||||||
auto id = next_constructor_id_++;
|
auto id = next_constructor_id_++;
|
||||||
|
|
||||||
auto constructor_factory = [function = std::move(function)](std::vector<std::uint32_t> const & column_indices) -> detail::table_callback {
|
auto constructor_factory = [function = std::move(function)](std::vector<std::uint32_t> const & column_indices) -> detail::table_callback
|
||||||
return [function, column_indices](container & container, detail::table & table, std::uint32_t row, util::hash_set<util::uuid> const & attached_components, util::hash_set<util::uuid> const & detached_components, bool force){
|
{
|
||||||
|
return [function, column_indices](container & container, detail::table & table, std::uint32_t row, util::hash_set<util::uuid> const & attached_components, util::hash_set<util::uuid> const & detached_components, bool force) mutable
|
||||||
|
{
|
||||||
bool const invoke = force
|
bool const invoke = force
|
||||||
|| (detail::contains_helper<Components>::contains(attached_components) || ...)
|
|| (detail::contains_helper<Components>::contains(attached_components) || ...)
|
||||||
|| (detail::contains_helper<Components>::contains_without(detached_components) || ...)
|
|| (detail::contains_helper<Components>::contains_without(detached_components) || ...)
|
||||||
|
|
@ -764,8 +765,10 @@ namespace psemek::ecs
|
||||||
|
|
||||||
auto id = next_destructor_id_++;
|
auto id = next_destructor_id_++;
|
||||||
|
|
||||||
auto destructor_factory = [function = std::move(function)](std::vector<std::uint32_t> const & column_indices) -> detail::table_callback {
|
auto destructor_factory = [function = std::move(function)](std::vector<std::uint32_t> const & column_indices) -> detail::table_callback
|
||||||
return [function, column_indices](container & container, detail::table & table, std::uint32_t row, util::hash_set<util::uuid> const & attached_components, util::hash_set<util::uuid> const & detached_components, bool force){
|
{
|
||||||
|
return [function, column_indices](container & container, detail::table & table, std::uint32_t row, util::hash_set<util::uuid> const & attached_components, util::hash_set<util::uuid> const & detached_components, bool force) mutable
|
||||||
|
{
|
||||||
bool const invoke = force
|
bool const invoke = force
|
||||||
|| (detail::contains_helper<Components>::contains_without(attached_components) || ...)
|
|| (detail::contains_helper<Components>::contains_without(attached_components) || ...)
|
||||||
|| (detail::contains_helper<Components>::contains(detached_components) || ...)
|
|| (detail::contains_helper<Components>::contains(detached_components) || ...)
|
||||||
|
|
@ -800,7 +803,7 @@ namespace psemek::ecs
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wrapper = [function = std::move(function)](ecs::container &){ function(); };
|
wrapper = [function = std::move(function)](ecs::container &) mutable { function(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_recursion_depth_ == 0)
|
if (method_recursion_depth_ == 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue