@@ -419,39 +419,53 @@ static auto print_execute_systems(
419
419
}
420
420
}
421
421
422
- for (auto provider : system_providers) {
423
- auto result = provider->entity_iteration (ctx, names, [&] {
424
- for (const auto & provider : system_providers) {
425
- provider->pre_exec_system_impl (ctx, names);
426
- }
422
+ auto exec_system_impls = [&](bool has_system_impl) {
423
+ for (auto provider : system_providers) {
424
+ auto result = provider->entity_iteration (ctx, names, [&] {
425
+ for (const auto & provider : system_providers) {
426
+ provider->pre_exec_system_impl (ctx, names);
427
+ }
428
+
429
+ context_init_provider
430
+ ->pre_exec_system_impl_context_init (ctx, names, context_type_name);
431
+
432
+ ecsact::rt_entt_codegen::core::print_child_systems (
433
+ ctx,
434
+ names,
435
+ sys_like_id
436
+ );
427
437
428
- context_init_provider
429
- ->pre_exec_system_impl_context_init (ctx, names, context_type_name);
438
+ if (has_system_impl) {
439
+ auto result =
440
+ std::ranges::find_if (system_providers, [&](auto provider) {
441
+ return provider->system_impl (ctx, names) ==
442
+ handle_exclusive_provide::HANDLED;
443
+ });
430
444
431
- ecsact::rt_entt_codegen::core::print_child_systems (
432
- ctx,
433
- names,
434
- sys_like_id
435
- );
445
+ if (result == system_providers.end ()) {
446
+ throw std::logic_error (" system_impl was not handled by providers" );
447
+ }
448
+ }
436
449
437
- auto result = std::ranges::find_if (system_providers, [&](auto provider) {
438
- return provider->system_impl (ctx, names) ==
439
- handle_exclusive_provide::HANDLED;
440
- });
441
-
442
- if (result == system_providers.end ()) {
443
- throw std::logic_error (" system_impl was not handled by providers" );
444
- }
450
+ for (const auto & provider : system_providers) {
451
+ provider->post_exec_system_impl (ctx, names);
452
+ }
445
453
446
- for (const auto & provider : system_providers) {
447
- provider->post_exec_system_impl (ctx, names);
454
+ ctx.write (" \n " );
455
+ });
456
+ if (result == handle_exclusive_provide::HANDLED) {
457
+ break ;
448
458
}
449
-
450
- ctx.write (" \n " );
451
- });
452
- if (result == handle_exclusive_provide::HANDLED) {
453
- break ;
454
459
}
460
+ };
461
+
462
+ auto child_ids = ecsact::meta::get_child_system_ids (sys_like_id);
463
+ if (child_ids.empty ()) {
464
+ // system impl was already checked at start
465
+ exec_system_impls (true );
466
+ } else {
467
+ block (ctx, " if(system_impl == nullptr)" , [&] { exec_system_impls (false ); });
468
+ block (ctx, " else" , [&] { exec_system_impls (true ); });
455
469
}
456
470
457
471
for (const auto & provider : system_providers) {
@@ -541,7 +555,11 @@ static auto print_execute_system_template_specialization(
541
555
" >();\n "
542
556
);
543
557
544
- block (ctx, " if(system_impl == nullptr)" , [&] { ctx.write (" return;" ); });
558
+ auto child_ids = ecsact::meta::get_child_system_ids (system_id);
559
+ if (child_ids.empty ()) {
560
+ block (ctx, " if(system_impl == nullptr)" , [&] { ctx.write (" return;" ); });
561
+ ctx.write (" \n " );
562
+ }
545
563
546
564
print_execute_systems (
547
565
ctx,
@@ -591,7 +609,11 @@ static auto print_execute_actions_template_specialization(
591
609
" >();\n "
592
610
);
593
611
594
- block (ctx, " if(system_impl == nullptr)" , [&] { ctx.write (" return;" ); });
612
+ auto child_ids = ecsact::meta::get_child_system_ids (action_id);
613
+ if (child_ids.empty ()) {
614
+ block (ctx, " if(system_impl == nullptr)" , [&] { ctx.write (" return;" ); });
615
+ ctx.write (" \n " );
616
+ }
595
617
596
618
ctx.write (
597
619
" auto actions = actions_map.as_action_span<" ,
0 commit comments