From 94e5e592baea2935af7c94ad44805a09d0e30740 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 9 Apr 2025 20:50:14 +0200 Subject: feat(ecs): replace Relationship component with pair UID support --- ecs/src/query/flexible.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ecs/src/query/flexible.rs') diff --git a/ecs/src/query/flexible.rs b/ecs/src/query/flexible.rs index 2f0b5e7..3e72b34 100644 --- a/ecs/src/query/flexible.rs +++ b/ecs/src/query/flexible.rs @@ -16,6 +16,7 @@ use crate::World; #[derive(Debug)] pub struct Query<'world, const MAX_TERM_CNT: usize> { + world: &'world World, component_storage: ReadGuard<'world, ComponentStorage>, terms: Terms, } @@ -27,6 +28,7 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT> pub fn iter(&self) -> Iter<'_> { Iter { + world: self.world, iter: self .component_storage .search_archetypes(ArchetypeSearchTerms { @@ -45,6 +47,7 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT> pub(crate) fn new(world: &'world World, terms: Terms) -> Self { Self { + world, component_storage: world .data .component_storage @@ -57,6 +60,7 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT> pub struct Iter<'query> { + world: &'query World, iter: QueryEntityIter<'query>, } @@ -68,7 +72,7 @@ impl<'query> Iterator for Iter<'query> { let (archetype, entity) = self.iter.next()?; - Some(EntityHandle::new(archetype, entity)) + Some(EntityHandle::new(self.world, archetype, entity)) } } -- cgit v1.2.3-18-g5258