File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,13 @@ void trivial_system_impl(
92
92
if constexpr (!C::transient) {
93
93
info.registry .template emplace <component_removed<C>>(entity);
94
94
95
- auto & temp = info.registry .template storage <temp_storage<C>>();
96
- if (temp.contains (entity)) {
97
- temp.get (entity).value = info.registry .template get <C>(entity);
98
- } else {
99
- temp.emplace (entity, info.registry .template get <C>(entity));
95
+ if constexpr (!std::is_empty_v<C>) {
96
+ auto & temp = info.registry .template storage <temp_storage<C>>();
97
+ if (temp.contains (entity)) {
98
+ temp.get (entity).value = info.registry .template get <C>(entity);
99
+ } else {
100
+ temp.emplace (entity, info.registry .template get <C>(entity));
101
+ }
100
102
}
101
103
}
102
104
});
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ void runtime_test::TrivialRemove::impl(context& ctx) {
37
37
std::abort ();
38
38
}
39
39
40
+ void runtime_test::AlwaysRemove::impl (context& ctx) {
41
+ // This trivial remove should not even be required:
42
+ // SEE: https://github.com/ecsact-dev/ecsact_lang_cpp/issues/80
43
+ std::cerr << " AlwaysRemove impl called (SHOULD NOT HAPPEN)\n " ;
44
+ std::cerr.flush ();
45
+ std::abort ();
46
+ }
47
+
40
48
TEST (Core, CreateRegistry) {
41
49
auto reg_id = ecsact_create_registry (" CreateRegistry" );
42
50
EXPECT_NE (reg_id, ecsact_invalid_registry_id);
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ component OtherEntityComponent {
11
11
12
12
component EmptyComponent;
13
13
14
+ component AlwaysRemoveMe;
15
+
14
16
system SimpleSystem {
15
17
readwrite ComponentA;
16
18
}
@@ -28,6 +30,10 @@ system OtherEntitySystem {
28
30
}
29
31
}
30
32
33
+ system AlwaysRemove {
34
+ removes AlwaysRemoveMe;
35
+ }
36
+
31
37
action MakeAnother {
32
38
readwrite ComponentA;
33
39
generates {
You can’t perform that action at this time.
0 commit comments