summaryrefslogtreecommitdiff
path: root/ecs/src/query
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/query')
-rw-r--r--ecs/src/query/flexible.rs4
-rw-r--r--ecs/src/query/term.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/ecs/src/query/flexible.rs b/ecs/src/query/flexible.rs
index 0caaa27..936ab82 100644
--- a/ecs/src/query/flexible.rs
+++ b/ecs/src/query/flexible.rs
@@ -36,6 +36,7 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT>
.zip(archetype.entities())
}) as ComponentIterMapFn,
),
+ world: self.world,
}
}
@@ -65,6 +66,7 @@ impl<'query, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'_, MAX_T
pub struct Iter<'query>
{
iter: QueryEntityIter<'query>,
+ world: &'query World,
}
impl<'query> Iterator for Iter<'query>
@@ -75,7 +77,7 @@ impl<'query> Iterator for Iter<'query>
{
let (archetype, entity) = self.iter.next()?;
- Some(EntityHandle::new(archetype, entity))
+ Some(EntityHandle::new(archetype, entity, self.world))
}
}
diff --git a/ecs/src/query/term.rs b/ecs/src/query/term.rs
index c8a96b6..0683918 100644
--- a/ecs/src/query/term.rs
+++ b/ecs/src/query/term.rs
@@ -95,7 +95,7 @@ impl<ComponentT: Component> TermWithField for Option<&mut ComponentT>
fn get_field<'world>(
entity_handle: &crate::entity::Handle<'world>,
- _world: &'world crate::World,
+ world: &'world crate::World,
) -> Self::Field<'world>
{
Some(
@@ -103,6 +103,7 @@ impl<ComponentT: Component> TermWithField for Option<&mut ComponentT>
&entity_handle
.get_matching_components(ComponentT::id())
.next()?,
+ world,
)
.unwrap_or_else(|err| {
panic!(