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