@@ -168,6 +168,8 @@ types::cpp_execution_options util::c_to_cpp_execution_options(
168
168
cpp_options.updates .reserve (options.update_components_length );
169
169
cpp_options.removes .reserve (options.remove_components_length );
170
170
cpp_options.actions .reserve (options.actions_length );
171
+ cpp_options.create_entities .reserve (options.create_entities_length );
172
+ cpp_options.destroy_entities .reserve (options.destroy_entities_length );
171
173
172
174
if (options.add_components != nullptr ) {
173
175
for (int i = 0 ; i < options.add_components_length ; i++) {
@@ -231,6 +233,35 @@ types::cpp_execution_options util::c_to_cpp_execution_options(
231
233
cpp_options.actions .push_back (action_info);
232
234
}
233
235
}
236
+
237
+ if (options.create_entities_components != nullptr ) {
238
+ for (int i = 0 ; i < options.create_entities_length ; i++) {
239
+ types::entity_create_options entity_to_create{};
240
+ auto component_list_length = options.create_entities_components_length [i];
241
+ entity_to_create.components .reserve (component_list_length);
242
+
243
+ for (int j = 0 ; j < component_list_length; j++) {
244
+ types::cpp_component new_entity_component{};
245
+
246
+ auto component = options.create_entities_components [i][j];
247
+ auto serialized_component = ecsact::serialize (component);
248
+
249
+ new_entity_component._id = component.component_id ;
250
+ new_entity_component.data = serialized_component;
251
+ entity_to_create.components .push_back (new_entity_component);
252
+ }
253
+ cpp_options.create_entities .push_back (entity_to_create);
254
+ }
255
+ }
256
+
257
+ if (options.destroy_entities != nullptr ) {
258
+ cpp_options.destroy_entities .insert (
259
+ cpp_options.destroy_entities .begin (),
260
+ options.destroy_entities ,
261
+ options.destroy_entities + options.destroy_entities_length
262
+ );
263
+ }
264
+
234
265
return cpp_options;
235
266
}
236
267
0 commit comments