summaryrefslogtreecommitdiff
path: root/src/components.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-16 23:25:04 +0100
committertroido <troido@protonmail.com>2020-02-16 23:25:04 +0100
commitc9a11aec577a0927afb4e97f3041b492621ce666 (patch)
treed27ab608da72a7b17741a76da37886bd85878b8c /src/components.rs
parent10bf24f99efb87b586590b8785ac8fe337db96e5 (diff)
added playerid to avoid stringly typing
Diffstat (limited to 'src/components.rs')
-rw-r--r--src/components.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components.rs b/src/components.rs
index 1f5630d..126f20e 100644
--- a/src/components.rs
+++ b/src/components.rs
@@ -7,8 +7,8 @@ use specs::{
Component
};
-use super::controls::Control;
-use super::pos::Pos;
+use crate::{Pos, PlayerId};
+use crate::controls::Control;
use crate::template::Template;
@@ -58,11 +58,11 @@ pub struct Moved {
#[derive(Component, Debug, Clone)]
#[storage(HashMapStorage)]
pub struct Player {
- pub name: String
+ pub id: PlayerId
}
impl Player {
- pub fn new(name: String) -> Self {
- Self{name}
+ pub fn new(id: PlayerId) -> Self {
+ Self{id}
}
}