From 1d2ded384e2669d8f48a6b138b232d0eecd214d0 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 1 Dec 2026 16:45:58 +0100 Subject: refactor(engine-ecs): store component::Info in component::Parts --- engine-ecs/src/lib.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'engine-ecs/src/lib.rs') diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index 711b3c8..ee2dca6 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -212,7 +212,7 @@ impl World assert!( !component_parts.is_sole, "Cannot add sole component {} to an entity", - component_parts.name + component_parts.id ); Self::add_entity_components( @@ -624,13 +624,13 @@ impl World self.data.component_storage.create_entity(sole_parts.id) { tracing::error!( - name = %sole_parts.name, + id = %sole_parts.id, "Can not create sole that already exists" ); continue; } - let name = sole_parts.name.clone(); + let name = sole_parts.component_info.name.clone(); Self::add_entity_components( sole_parts.id, @@ -664,12 +664,11 @@ impl World for component_parts in component_iter { assert!( flags.allow_soles || !component_parts.is_sole, - "Cannot add sole component '{}' to an entity", - component_parts.name + "Cannot add sole component {} to an entity", + component_parts.id ); let comp_id = component_parts.id; - let comp_name = component_parts.name; if let Err(err) = component_storage .add_entity_component(entity_uid, (comp_id, component_parts.data)) @@ -683,7 +682,6 @@ impl World entity = %entity_uid, entity_name = ent_name.as_ref().map(|ent_name| ent_name.name.as_ref()), component = %comp_id, - component_name = %comp_name, "Failed to add component to entity: {err}" ); @@ -725,12 +723,7 @@ impl World Self::create_component_info_entity_if_missing( component_storage, comp_id, - ComponentInfo { - type_reflection: component_parts.type_reflection, - name: comp_name, - type_name: component_parts.type_name, - is_sole: component_parts.is_sole, - }, + component_parts.component_info, ); event_submitter.submit_event( -- cgit v1.2.3-18-g5258