summaryrefslogtreecommitdiff
path: root/ecs/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-08-14 19:58:45 +0200
committerHampusM <hampus@hampusmat.com>2024-08-14 19:58:45 +0200
commite9074af15cae7b3c354e524e9fa78cbddb20ff84 (patch)
treea7ebc15723d3d2d174300658ae6429c3b9970433 /ecs/src
parent79ac38c548079f8545dcf06aa443274a5e9e53fd (diff)
fix(ecs): prevent duplicate archetype indices in lookup entries
Diffstat (limited to 'ecs/src')
-rw-r--r--ecs/src/component/storage.rs5
1 files changed, 5 insertions, 0 deletions
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);
}