Skip to content

Commit f30e725

Browse files
authored
fix: Let tag components call get_component, add missing export (#145)
1 parent c88cc16 commit f30e725

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ ecsact_build_recipe(
132132
exports = [
133133
# core
134134
"ecsact_execute_systems",
135+
"ecsact_create_registry",
135136
"ecsact_destroy_registry",
136137
"ecsact_clear_registry",
137138
"ecsact_create_entity",
@@ -163,6 +164,8 @@ ecsact_build_recipe(
163164
],
164165
)
165166

167+
exports_files(["build_recipe.yml"])
168+
166169
ecsact_build_recipe_bundle(
167170
name = "ecsact_rt_entt",
168171
recipes = [":ecsact_rt_entt_recipe"],

ecsact/entt/wrapper/core.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ inline auto get_component(
3232
[[maybe_unused]] ecsact_component_id component_id,
3333
...
3434
) -> const void* {
35+
if constexpr(std::is_empty_v<C>) {
36+
static C emptyVal;
37+
return &emptyVal;
38+
}
3539
auto& reg = ecsact::entt::get_registry(registry_id);
3640
auto entity = ecsact::entt::entity_id{entity_id};
3741
assert(C::id == component_id);

rt_entt_codegen/rt_entt_codegen.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,13 @@ void ecsact_codegen_plugin(
195195
return;
196196
}
197197

198-
auto non_tag_component_ids =
199-
details.all_components |
200-
std::views::filter([&](ecsact_component_id comp_id) -> bool {
201-
return !ecsact::meta::get_field_ids(comp_id).empty();
202-
});
203-
204198
ctx.write(
205199
"result.reserve(",
206-
std::ranges::distance(non_tag_component_ids),
200+
std::ranges::distance(details.all_components),
207201
");\n"
208202
);
209203

210-
for(auto comp_id : non_tag_component_ids) {
204+
for(auto comp_id : details.all_components) {
211205
auto cpp_comp_name = cpp_identifier(decl_full_name(comp_id));
212206
ctx.write(
213207
"result.insert({::",

0 commit comments

Comments
 (0)