diff options
Diffstat (limited to 'ecs/src/query/term.rs')
-rw-r--r-- | ecs/src/query/term.rs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/ecs/src/query/term.rs b/ecs/src/query/term.rs index 78668c5..597dd1a 100644 --- a/ecs/src/query/term.rs +++ b/ecs/src/query/term.rs @@ -8,42 +8,43 @@ use crate::query::{ TermsBuilder, TermsBuilderInterface, }; +use crate::uid::With as WithUid; -pub struct With<ComponentT> +pub struct With<WithUidT> where - ComponentT: Component, + WithUidT: WithUid, { - _pd: PhantomData<ComponentT>, + _pd: PhantomData<WithUidT>, } -impl<ComponentT> TermWithoutField for With<ComponentT> +impl<WithUidT> TermWithoutField for With<WithUidT> where - ComponentT: Component, + WithUidT: WithUid, { fn apply_to_terms_builder<const MAX_TERM_CNT: usize>( terms_builder: &mut TermsBuilder<MAX_TERM_CNT>, ) { - terms_builder.with::<ComponentT>(); + terms_builder.with::<WithUidT>(); } } -pub struct Without<ComponentT> +pub struct Without<WithUidT> where - ComponentT: Component, + WithUidT: WithUid, { - _pd: PhantomData<ComponentT>, + _pd: PhantomData<WithUidT>, } -impl<ComponentT> TermWithoutField for Without<ComponentT> +impl<WithUidT> TermWithoutField for Without<WithUidT> where - ComponentT: Component, + WithUidT: WithUid, { fn apply_to_terms_builder<const MAX_TERM_CNT: usize>( terms_builder: &mut TermsBuilder<MAX_TERM_CNT>, ) { - terms_builder.without::<ComponentT>(); + terms_builder.without::<WithUidT>(); } } @@ -66,7 +67,11 @@ where { Some( ComponentRefT::Handle::<'world>::from_entity_component_ref( - Some(entity_handle.get_component(ComponentRefT::Component::id())?), + Some( + entity_handle + .get_matching_components(ComponentRefT::Component::id()) + .next()?, + ), world, ) .unwrap_or_else(|err| { |