File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,9 @@ struct system_execution_context : system_execution_context_base {
175
175
if constexpr (!C::transient) {
176
176
if (info.registry .template all_of <component_added<C>>(entity)) {
177
177
info.registry .template remove <component_added<C>>(entity);
178
+ info.registry .template remove <component_removed<C>>(entity);
179
+ } else {
180
+ info.registry .template emplace_or_replace <component_removed<C>>(entity);
178
181
}
179
182
if constexpr (!std::is_empty_v<C>) {
180
183
auto & temp = info.registry .template storage <temp_storage<C>>();
@@ -191,10 +194,6 @@ struct system_execution_context : system_execution_context_base {
191
194
// TODO(zaucy): Look into if emplace_or_replace is necessary instead of
192
195
// just replace.
193
196
info.registry .template emplace_or_replace <pending_remove<C>>(entity);
194
-
195
- if constexpr (!C::transient) {
196
- info.registry .template emplace_or_replace <component_removed<C>>(entity);
197
- }
198
197
}
199
198
200
199
void remove (ecsact_component_like_id component_id) {
Original file line number Diff line number Diff line change @@ -85,7 +85,13 @@ void trivial_system_impl(
85
85
info.registry .template emplace <pending_remove<C>>(entity);
86
86
87
87
if constexpr (!C::transient) {
88
- info.registry .template emplace <component_removed<C>>(entity);
88
+ if (info.registry .template all_of <component_added<C>>(entity)) {
89
+ info.registry .template remove <component_added<C>>(entity);
90
+ info.registry .template remove <component_removed<C>>(entity);
91
+ } else {
92
+ info.registry .template emplace_or_replace <component_removed<C>>(entity
93
+ );
94
+ }
89
95
90
96
if constexpr (!std::is_empty_v<C>) {
91
97
auto & temp = info.registry .template storage <temp_storage<C>>();
You can’t perform that action at this time.
0 commit comments