Skip to content

Commit 75629b8

Browse files
authored
Initial commit, make remove callbacks invoke on empty components (#20)
1 parent fa50a30 commit 75629b8

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"[cpp]": {
2424
"editor.detectIndentation": false,
25-
"editor.defaultFormatter": "xaver.clang-format"
25+
"editor.defaultFormatter": "Seaube.ClangFormat"
2626
},
2727
"[starlark]": {
2828
"editor.defaultFormatter": "BazelBuild.vscode-bazel",

ecsact/entt/runtime.hh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -843,25 +843,29 @@ private:
843843
return;
844844
}
845845

846-
::entt::basic_view removed_view{
847-
info.registry.template storage<detail::temp_storage<C>>(),
848-
info.registry.template storage<component_removed<C>>(),
849-
};
850-
851-
for(entt_entity_type entity : removed_view) {
852-
if constexpr(std::is_empty_v<C>) {
846+
if constexpr(std::is_empty_v<C>) {
847+
::entt::basic_view removed_view{
848+
info.registry.template storage<component_removed<C>>(),
849+
};
850+
for(entt_entity_type entity : removed_view) {
853851
events_collector.invoke_remove_callback<C>(
854852
info.get_ecsact_entity_id(entity)
855853
);
856-
} else {
854+
}
855+
} else {
856+
::entt::basic_view removed_view{
857+
info.registry.template storage<detail::temp_storage<C>>(),
858+
info.registry.template storage<component_removed<C>>(),
859+
};
860+
for(entt_entity_type entity : removed_view) {
857861
events_collector.invoke_remove_callback<C>(
858862
info.get_ecsact_entity_id(entity),
859863
removed_view.template get<detail::temp_storage<C>>(entity).value
860864
);
865+
info.registry.template storage<detail::temp_storage<C>>().remove(
866+
entity
867+
);
861868
}
862-
863-
info.registry.template storage<detail::temp_storage<C>>().remove(entity
864-
);
865869
}
866870
});
867871
}

0 commit comments

Comments
 (0)