5
5
#include " ecsact/lang-support/lang-cc.hh"
6
6
#include " ecsact/cpp_codegen_plugin_util.hh"
7
7
8
+ #include < iostream>
9
+
8
10
struct loop_iterator_fields {
9
11
std::vector<ecsact_system_like_id>& system_list;
10
12
const std::vector<ecsact_system_like_id>::iterator begin;
@@ -147,8 +149,49 @@ auto loop_iterator(
147
149
return ;
148
150
}
149
151
152
+ std::set<ecsact_component_like_id> child_unsafe_comps{};
153
+
154
+ auto child_systems = ecsact::meta::get_child_system_ids (sys_like_id);
155
+
156
+ for (auto child_sys_id : child_systems) {
157
+ auto cpp_system_name = decl_full_name (child_sys_id);
158
+ auto child_capabilities = ecsact::meta::system_capabilities (child_sys_id);
159
+ for (auto const [child_comp_id, child_capability] : child_capabilities) {
160
+ if (unsafe_comps.contains (child_comp_id)) {
161
+ if (child_capability == ECSACT_SYS_CAP_READONLY ||
162
+ child_capability == ECSACT_SYS_CAP_OPTIONAL_READONLY) {
163
+ parallel_system_cluster.push_back (parallel_system_list);
164
+ loop_iterator (system_list, iterator, parallel_system_cluster);
165
+ return ;
166
+ }
167
+ }
168
+
169
+ if (!is_capability_safe (child_capability)) {
170
+ if (unsafe_comps.contains (child_comp_id)) {
171
+ parallel_system_cluster.push_back (parallel_system_list);
172
+ loop_iterator (system_list, iterator, parallel_system_cluster);
173
+ return ;
174
+ } else {
175
+ child_unsafe_comps.insert (child_comp_id);
176
+ }
177
+ // std::cout << " STUCK ON " << cpp_name << "COMPONENT IN THE "
178
+ // << cpp_system_name << std::endl;
179
+ }
180
+ }
181
+ }
182
+
150
183
for (const auto [comp_id, capability] : capabilities) {
151
184
auto cpp_name = decl_full_name (comp_id);
185
+
186
+ if (unsafe_comps.contains (comp_id)) {
187
+ if (capability == ECSACT_SYS_CAP_READONLY ||
188
+ capability == ECSACT_SYS_CAP_OPTIONAL_READONLY) {
189
+ parallel_system_cluster.push_back (parallel_system_list);
190
+ loop_iterator (system_list, iterator, parallel_system_cluster);
191
+ return ;
192
+ }
193
+ }
194
+
152
195
if (!is_capability_safe (capability)) {
153
196
if (!unsafe_comps.contains (comp_id)) {
154
197
unsafe_comps.insert (comp_id);
@@ -158,6 +201,7 @@ auto loop_iterator(
158
201
return ;
159
202
}
160
203
}
204
+
161
205
auto other_fields =
162
206
ecsact::meta::system_association_fields (sys_like_id, comp_id);
163
207
@@ -168,7 +212,7 @@ auto loop_iterator(
168
212
field_id
169
213
);
170
214
171
- for (auto [other_comp_id, other_capability] : other_capabilities) {
215
+ for (const auto [other_comp_id, other_capability] : other_capabilities) {
172
216
auto cpp_name = decl_full_name (other_comp_id);
173
217
if (!is_capability_safe (other_capability)) {
174
218
if (!unsafe_comps.contains (other_comp_id)) {
@@ -182,6 +226,13 @@ auto loop_iterator(
182
226
}
183
227
}
184
228
}
229
+
230
+ for (auto unsafe_comp : child_unsafe_comps) {
231
+ if (!unsafe_comps.contains (unsafe_comp)) {
232
+ unsafe_comps.insert (unsafe_comp);
233
+ }
234
+ }
235
+
185
236
parallel_system_list.push_back (sys_like_id);
186
237
}
187
238
parallel_system_cluster.push_back (parallel_system_list);
0 commit comments