From e9074af15cae7b3c354e524e9fa78cbddb20ff84 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 14 Aug 2024 19:58:45 +0200 Subject: fix(ecs): prevent duplicate archetype indices in lookup entries --- ecs/src/component/storage.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ecs/src') diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs index 944beb3..f8b5b20 100644 --- a/ecs/src/component/storage.rs +++ b/ecs/src/component/storage.rs @@ -240,6 +240,11 @@ impl Storage continue; } + // There shouldn't be duplicate archetype indices in the lookup entry + if lookup_entry.archetype_indices.contains(&archetype_index) { + continue; + } + if lookup_entry.component_ids.is_subset(&comp_ids_set) { lookup_entry.archetype_indices.push(archetype_index); } -- cgit v1.2.3-18-g5258