diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-16 13:17:57 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-16 13:17:57 +0200 |
commit | d50a2f6e63c25adf3b64652310c423717bd3966f (patch) | |
tree | 3edf4ee3d1eec93a52a8de4fdc5a7be5c487c711 /ecs/src/system/stateful.rs | |
parent | 69d90ece7f54996f0f51fc120a38d37717c5248e (diff) |
refactor(ecs): add component ID struct
Diffstat (limited to 'ecs/src/system/stateful.rs')
-rw-r--r-- | ecs/src/system/stateful.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs index b765ff0..ae6a5b5 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; +use crate::component::{Component, Id as ComponentId}; use crate::lock::Lock; use crate::system::util::check_params_are_compatible; use crate::system::{ @@ -27,7 +27,7 @@ use crate::WorldData; pub struct Stateful<Func> { func: Func, - local_components: HashMap<TypeId, Lock<Box<dyn Component>>>, + local_components: HashMap<ComponentId, Lock<Box<dyn Component>>>, } macro_rules! impl_system { @@ -134,7 +134,7 @@ macro_rules! impl_system { ) -> Option<ComponentRefMut<LocalComponent>> { let local_component = self.local_components - .get(&TypeId::of::<LocalComponent>())? + .get(&ComponentId::of::<LocalComponent>())? .write_nonblock() .expect("Failed to aquire read-write local component lock"); @@ -148,7 +148,7 @@ macro_rules! impl_system { { self.local_components .insert( - TypeId::of::<LocalComponent>(), + ComponentId::of::<LocalComponent>(), Lock::new(Box::new(local_component)) ); } |