diff options
Diffstat (limited to 'engine-ecs/src/component')
| -rw-r--r-- | engine-ecs/src/component/storage.rs | 8 | ||||
| -rw-r--r-- | engine-ecs/src/component/storage/archetype.rs | 13 |
2 files changed, 5 insertions, 16 deletions
diff --git a/engine-ecs/src/component/storage.rs b/engine-ecs/src/component/storage.rs index 98f8d46..7a49110 100644 --- a/engine-ecs/src/component/storage.rs +++ b/engine-ecs/src/component/storage.rs @@ -261,7 +261,7 @@ impl Storage pub fn add_entity_component( &mut self, entity_uid: Uid, - (component_id, component_name, component): (Uid, &'static str, Box<dyn Any>), + (component_id, component): (Uid, Box<dyn Any>), ) -> Result<(), Error> { let Some(archetype_id) = self.entity_archetype_lookup.get(&entity_uid) else { @@ -334,7 +334,7 @@ impl Storage entity.insert_component( component_id, - ArchetypeEntityComponent::new(component, component_name), + ArchetypeEntityComponent::new(component), add_edge_archetype, ); @@ -403,8 +403,7 @@ impl Storage .remove_entity(entity_uid) .expect("Entity should exist in archetype"); - let removed_component = - entity.remove_component(component_id, archetype_node.archetype()); + entity.remove_component(component_id, archetype_node.archetype()); self.graph .get_node_by_id_mut(remove_edge_id) @@ -418,7 +417,6 @@ impl Storage tracing::debug!( entity_id = %entity_uid, component_id = %component_id, - component_name = removed_component.name(), "Removed component from entity" ); diff --git a/engine-ecs/src/component/storage/archetype.rs b/engine-ecs/src/component/storage/archetype.rs index 480a1da..64ab587 100644 --- a/engine-ecs/src/component/storage/archetype.rs +++ b/engine-ecs/src/component/storage/archetype.rs @@ -328,28 +328,19 @@ impl Entity pub struct EntityComponent { component: Lock<Box<dyn Any>>, - name: &'static str, } impl EntityComponent { - pub fn new(component: Box<dyn Any>, component_name: &'static str) -> Self + pub fn new(component: Box<dyn Any>) -> Self { - Self { - component: Lock::new(component, component_name), - name: component_name, - } + Self { component: Lock::new(component) } } pub fn component(&self) -> &Lock<Box<dyn Any>> { &self.component } - - pub fn name(&self) -> &str - { - self.name - } } /// Archetype ID. |
