From daf0bc236df25c0e9f44bc3e30839c16cda3f638 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 11 Nov 2024 00:11:22 +0100 Subject: refactor(ecs): use same ID for entities & components --- ecs/src/system/stateful.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ecs/src/system/stateful.rs') diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs index 99b56c1..810a071 100644 --- a/ecs/src/system/stateful.rs +++ b/ecs/src/system/stateful.rs @@ -4,7 +4,7 @@ use std::panic::{RefUnwindSafe, UnwindSafe}; use seq_macro::seq; -use crate::component::{Component, Id as ComponentId}; +use crate::component::Component; use crate::lock::Lock; use crate::system::util::check_params_are_compatible; use crate::system::{ @@ -21,13 +21,14 @@ use crate::tuple::{ TakeOptionElementResult as TupleTakeOptionElementResult, WithOptionElements as TupleWithOptionElements, }; +use crate::uid::Uid; use crate::World; /// A stateful system. pub struct Stateful { func: Func, - local_components: HashMap>>, + local_components: HashMap>>, } macro_rules! impl_system { @@ -125,7 +126,7 @@ macro_rules! impl_system { ) -> Option> { let local_component = self.local_components - .get(&ComponentId::of::())? + .get(&LocalComponent::id())? .write_nonblock() .expect("Failed to aquire read-write local component lock"); @@ -139,7 +140,7 @@ macro_rules! impl_system { { self.local_components .insert( - ComponentId::of::(), + LocalComponent::id(), Lock::new(Box::new(local_component)) ); } -- cgit v1.2.3-18-g5258