summaryrefslogtreecommitdiff
path: root/engine-ecs/src/component/storage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/component/storage.rs')
-rw-r--r--engine-ecs/src/component/storage.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/engine-ecs/src/component/storage.rs b/engine-ecs/src/component/storage.rs
index e77cfa3..a4944c7 100644
--- a/engine-ecs/src/component/storage.rs
+++ b/engine-ecs/src/component/storage.rs
@@ -27,8 +27,8 @@ mod graph;
#[derive(Debug)]
pub struct ArchetypeSearchTerms<'a>
{
- pub required_components: &'a [Uid],
- pub excluded_components: &'a [Uid],
+ pub present: &'a [Uid],
+ pub absent: &'a [Uid],
}
impl ArchetypeSearchTerms<'_>
@@ -40,10 +40,10 @@ impl ArchetypeSearchTerms<'_>
|| (comp_id.is_pair() && comp_id.target() != Uid::wildcard())
);
- let is_found = self.excluded_components.binary_search(&comp_id).is_ok();
+ let is_found = self.absent.binary_search(&comp_id).is_ok();
if !is_found && comp_id.is_pair() {
- return self.excluded_components.iter().any(|excluded_comp_id| {
+ return self.absent.iter().any(|excluded_comp_id| {
excluded_comp_id.is_pair()
&& excluded_comp_id.has_same_relation_as(comp_id)
&& excluded_comp_id.target() == Uid::wildcard()
@@ -55,8 +55,8 @@ impl ArchetypeSearchTerms<'_>
fn contains_conflicting(&self) -> bool
{
- self.excluded_components.iter().any(|excluded_comp_id| {
- self.required_components
+ self.absent.iter().any(|excluded_comp_id| {
+ self.present
.binary_search(excluded_comp_id)
.is_ok()
})
@@ -64,7 +64,7 @@ impl ArchetypeSearchTerms<'_>
fn archetype_contains_all_required(&self, archetype: &Archetype) -> bool
{
- self.required_components
+ self.present
.iter()
.all(|comp_id| archetype.contains_matching_component(*comp_id))
}
@@ -85,7 +85,7 @@ impl Storage
search_terms: ArchetypeSearchTerms<'search_terms>,
) -> ArchetypeRefIter<'_, 'search_terms>
{
- let archetype_id = ArchetypeId::new(search_terms.required_components);
+ let archetype_id = ArchetypeId::new(search_terms.present);
if search_terms.contains_conflicting() {
return ArchetypeRefIter {
@@ -102,14 +102,14 @@ impl Storage
self.imaginary_archetypes
.borrow_mut()
.push(ImaginaryArchetype {
- id: ArchetypeId::new(search_terms.required_components.iter().filter(
+ id: ArchetypeId::new(search_terms.present.iter().filter(
|required_comp_id| {
!required_comp_id.is_pair()
|| required_comp_id.target() != Uid::wildcard()
},
)),
component_ids: search_terms
- .required_components
+ .present
.iter()
.copied()
.filter(|required_comp_id| {
@@ -406,7 +406,7 @@ impl Storage
.get_node_by_id(node_id)
.expect("Graph node found through DFS doesn't exist");
- if node.archetype().component_cnt() < search_terms.required_components.len() {
+ if node.archetype().component_cnt() < search_terms.present.len() {
continue;
}
@@ -693,8 +693,8 @@ impl ArchetypeRefIter<'_, '_>
{
self.storage
.find_all_archetype_with_comps(&ArchetypeSearchTerms {
- required_components: imaginary_archetype_comps,
- excluded_components: &[],
+ present: imaginary_archetype_comps,
+ absent: &[],
})
.into_iter()
.filter_map(|found_id| {