Skip to content

Commit be924bf

Browse files
authored
fixup: checking for dependency actions (#54)
1 parent 2fa2c35 commit be924bf

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

ecsact/entt/runtime.hh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,30 @@ namespace ecsact::entt {
3030
template<typename Package>
3131
class runtime {
3232
/**
33-
* Checks if type T is listd as one of the actions in the ecact package.
33+
* Checks if type T is listd as one of the actions in the ecsact package or
34+
* one of it's dependencies.
3435
* @returns `true` if T is a component belonging to `package`, `false`
3536
* otherwise.
3637
*/
3738
template<typename T>
3839
static constexpr bool is_action() {
3940
using boost::mp11::mp_any;
41+
using boost::mp11::mp_append;
4042
using boost::mp11::mp_apply;
4143
using boost::mp11::mp_bind_front;
4244
using boost::mp11::mp_transform_q;
45+
using ecsact::entt::detail::mp_actions_t;
46+
using ecsact::entt::detail::mp_package_dependencies_recursive;
47+
48+
using actions = typename mp_append<
49+
mp_actions_t<Package>,
50+
mp_package_dependencies_recursive<typename Package::dependencies>>::type;
4351

4452
return mp_apply<
4553
mp_any,
4654
mp_transform_q<
4755
mp_bind_front<std::is_same, std::remove_cvref_t<T>>,
48-
typename Package::actions>>::value;
56+
actions>>::value;
4957
}
5058

5159
using registry_info = ecsact_entt_rt::registry_info<Package>;

runtime/dynamic.template.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ void ecsact_system_execution_context_action(
4949
ecsact_system_execution_context* context,
5050
void* out_action_data
5151
) {
52-
using boost::mp11::mp_for_each;
52+
using ecsact::entt::detail::mp_for_each_available_action;
5353

5454
auto action_id = static_cast<ecsact_action_id>(context->system_id);
5555

5656
cast_and_use_ctx(context, [&](auto& context) {
57-
mp_for_each<typename package::actions>([&]<typename A>(A) {
57+
mp_for_each_available_action<package>([&]<typename A>(A) {
5858
if(A::id == action_id) {
5959
A& out_action = *reinterpret_cast<A*>(out_action_data);
6060
out_action = *reinterpret_cast<const A*>(context.action);

0 commit comments

Comments
 (0)