Support ecs behavior::begin called when starting iteration over a species
This commit is contained in:
parent
34ee3f0a6e
commit
876cbd7362
1 changed files with 4 additions and 0 deletions
|
|
@ -142,6 +142,8 @@ namespace psemek::util
|
||||||
|
|
||||||
((std::get<Components *>(ctx.components) = get_species_component<Components>()), ...);
|
((std::get<Components *>(ctx.components) = get_species_component<Components>()), ...);
|
||||||
|
|
||||||
|
behavior.begin({id_}, *std::get<Components *>(ctx.components)...);
|
||||||
|
|
||||||
auto visit = [&](auto * ... ptrs)
|
auto visit = [&](auto * ... ptrs)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_invocable_v<Behavior, typename Components::data & ..., typename Behavior::context const &, Args const & ...>)
|
if constexpr (std::is_invocable_v<Behavior, typename Components::data & ..., typename Behavior::context const &, Args const & ...>)
|
||||||
|
|
@ -441,6 +443,8 @@ namespace psemek::util
|
||||||
return *std::get<Component *>(components);
|
return *std::get<Component *>(components);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void begin(species_handle, Components const & ...) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class policy
|
enum class policy
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue