Skip to content

Commit 19fd62e

Browse files
committed
chore: wip
1 parent 8e2f6b5 commit 19fd62e

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

ecsact/entt/detail/apply_pending.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <entt/entt.hpp>
4+
#include "ecsact/entt/registry.hh"
45
#include "ecsact/entt/wrapper/core.hh"
56
#include "ecsact/entt/detail/internal_markers.hh"
67

@@ -10,7 +11,7 @@ template<typename C>
1011
auto apply_pending_add(ecsact::entt::registry_t& registry) -> void {
1112
if constexpr(std::is_empty_v<C>) {
1213
registry.view<pending_add<C>>().each([&](auto entity) {
13-
C& comp = registry.emplace<C>(entity);
14+
registry.emplace<C>(entity);
1415
// lifecycle_on_add<C>(registry, entity, comp);
1516
});
1617
} else {

rt_entt_codegen/core/system_provider/association/association.cc

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,16 @@ auto provider::association::context_function_header(
6565
);
6666
}
6767

68+
static auto push_back_unique(auto& vec, const auto& element) -> void {
69+
if(std::ranges::find(vec, element) == std::end(vec)) {
70+
vec.push_back(element);
71+
}
72+
}
73+
6874
auto provider::association::after_make_view_or_group(
6975
codegen_plugin_context& ctx,
7076
const common_vars& names
7177
) -> void {
72-
auto assoc_ids = ecsact::meta::system_assoc_ids(sys_like_id);
73-
for(auto assoc_id : assoc_ids) {
74-
auto assoc_caps =
75-
ecsact::meta::system_assoc_capabilities(sys_like_id, assoc_id);
76-
auto assoc_system_details =
77-
ecsact_entt_system_details::from_capabilities(assoc_caps);
78-
auto make_view_opts = util::make_view_options(assoc_system_details);
79-
make_view_opts.view_var_name = assoc_view_names.at(assoc_id);
80-
make_view_opts.registry_var_name = names.registry_var_name;
81-
82-
util::make_view(ctx, make_view_opts);
83-
}
8478
}
8579

8680
auto provider::association::context_function_other(
@@ -107,11 +101,24 @@ auto provider::association::entity_iteration(
107101
make_view_opts.registry_var_name = names.registry_var_name;
108102

109103
for(auto compo_id : assoc_composites.at(assoc_id)) {
104+
// TODO: At the time of writing this is safe. It's very possible we
105+
// allow actions to be referenecd in association fields in the near
106+
// future and at that point this must be addressed.
107+
auto comp_like_id = static_cast<ecsact_component_like_id>(compo_id);
108+
if(!assoc_system_details.get_comps.contains(comp_like_id)) {
109+
auto comp_cpp_ident = cpp_identifier(decl_full_name(comp_like_id));
110+
push_back_unique(
111+
make_view_opts.additional_components,
112+
comp_cpp_ident
113+
);
114+
}
110115
}
111116

112117
util::make_view(ctx, make_view_opts);
113118
}
114119

120+
print_other_contexts(ctx, names);
121+
115122
for(auto&& [assoc_id, compo_ids] : assoc_composites) {
116123
for(auto compo_id : compo_ids) {
117124
auto field_ids = assoc_fields.at(compo_id);
@@ -177,7 +184,6 @@ auto provider::association::pre_entity_iteration(
177184
codegen_plugin_context& ctx,
178185
const common_vars& names
179186
) -> void {
180-
print_other_contexts(ctx, names);
181187
}
182188

183189
auto provider::association::pre_exec_system_impl(

0 commit comments

Comments
 (0)