summaryrefslogtreecommitdiff
path: root/ecs/src/system
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-16 13:17:57 +0200
committerHampusM <hampus@hampusmat.com>2024-06-16 13:17:57 +0200
commitd50a2f6e63c25adf3b64652310c423717bd3966f (patch)
tree3edf4ee3d1eec93a52a8de4fdc5a7be5c487c711 /ecs/src/system
parent69d90ece7f54996f0f51fc120a38d37717c5248e (diff)
refactor(ecs): add component ID struct
Diffstat (limited to 'ecs/src/system')
-rw-r--r--ecs/src/system/stateful.rs8
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))
);
}