@@ -1028,16 +1028,41 @@ private:
1028
1028
if constexpr (C::transient) {
1029
1029
return ;
1030
1030
}
1031
+ });
1032
+ }
1031
1033
1032
- if (comp.component_id == static_cast <ecsact_component_id>(C::id)) {
1033
- if constexpr (!std::is_empty_v<C>) {
1034
- _pre_exec_update_component<C>(
1035
- info,
1036
- info.entities_map .at (entity),
1037
- *static_cast <const C*>(comp.component_data )
1034
+ void _trigger_remove_component_events
1035
+ ( registry_info& info
1036
+ , execution_events_collector& events_collector
1037
+ )
1038
+ {
1039
+ using boost::mp11::mp_for_each;
1040
+
1041
+ mp_for_each<typename package::components>([&]<typename C>(C) {
1042
+ if constexpr (C::transient) return ;
1043
+
1044
+ if constexpr (std::is_empty_v<C>) {
1045
+ ::entt::basic_view removed_view{
1046
+ info.registry .template storage <component_removed<C>>(),
1047
+ };
1048
+ for (entt_entity_type entity : empty_removed_view<C>) {
1049
+ events_collector.invoke_remove_callback <C>(
1050
+ info.get_ecsact_entity_id (entity)
1051
+ );
1052
+ }
1053
+ } else {
1054
+ ::entt::basic_view removed_view{
1055
+ info.registry .template storage <detail::temp_storage<C>>(),
1056
+ info.registry .template storage <component_removed<C>>(),
1057
+ };
1058
+ for (entt_entity_type entity : stored_removed_view<C>) {
1059
+ events_collector.invoke_remove_callback <C>(
1060
+ info.get_ecsact_entity_id (entity),
1061
+ removed_view.template get <detail::temp_storage<C>>(entity).value
1062
+ );
1063
+ info.registry .template storage <detail::temp_storage<C>>().remove (
1064
+ entity
1038
1065
);
1039
- } else {
1040
- assert (!std::is_empty_v<C>);
1041
1066
}
1042
1067
}
1043
1068
});
0 commit comments