From 80f1ea6f86665172105a5e928da21398c4f2f1ab Mon Sep 17 00:00:00 2001 From: Kelwan Date: Mon, 28 Oct 2024 16:46:04 -0700 Subject: [PATCH 1/2] fix: fauly logic on index of get components --- runtime/ecsact_rt_entt_core.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/runtime/ecsact_rt_entt_core.cc b/runtime/ecsact_rt_entt_core.cc index de5d9b7..675129f 100644 --- a/runtime/ecsact_rt_entt_core.cc +++ b/runtime/ecsact_rt_entt_core.cc @@ -176,14 +176,12 @@ void ecsact_get_components( auto index = 0; for(auto comp_id : all_component_ids) { - if(index >= max_components_count) { - break; - } - if(ecsact_has_component(registry_id, entity_id, comp_id, nullptr)) { - out_component_ids[index] = comp_id; - out_components_data[index] = - ecsact_get_component(registry_id, entity_id, comp_id, nullptr); + if(index >= max_components_count) { + out_component_ids[index] = comp_id; + out_components_data[index] = + ecsact_get_component(registry_id, entity_id, comp_id, nullptr); + } index += 1; } } From 0cae5945e2f88bd42fddba7879f855233c5b54ff Mon Sep 17 00:00:00 2001 From: Kelwan Date: Mon, 28 Oct 2024 17:32:18 -0700 Subject: [PATCH 2/2] fix: comparison mistake --- runtime/ecsact_rt_entt_core.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/ecsact_rt_entt_core.cc b/runtime/ecsact_rt_entt_core.cc index 675129f..f0d6a1f 100644 --- a/runtime/ecsact_rt_entt_core.cc +++ b/runtime/ecsact_rt_entt_core.cc @@ -177,7 +177,7 @@ void ecsact_get_components( auto index = 0; for(auto comp_id : all_component_ids) { if(ecsact_has_component(registry_id, entity_id, comp_id, nullptr)) { - if(index >= max_components_count) { + if(index < max_components_count) { out_component_ids[index] = comp_id; out_components_data[index] = ecsact_get_component(registry_id, entity_id, comp_id, nullptr);