summaryrefslogtreecommitdiff
path: root/src/room.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/room.rs
parent10bf24f99efb87b586590b8785ac8fe337db96e5 (diff)
added playerid to avoid stringly typing
Diffstat (limited to 'src/room.rs')
-rw-r--r--src/room.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/room.rs b/src/room.rs
index dbcfe0d..501b587 100644
--- a/src/room.rs
+++ b/src/room.rs
@@ -10,7 +10,6 @@ use specs::{
};
use super::controls::Action;
-use super::pos::Pos;
use super::worldmessages::WorldMessage;
use super::resources::{
Size,
@@ -32,6 +31,7 @@ use crate::components::{Position, Serialise};
use crate::encyclopedia::Encyclopedia;
use crate::roomtemplate::RoomTemplate;
use crate::savestate::SaveState;
+use crate::{Pos, PlayerId};
@@ -82,14 +82,12 @@ impl <'a, 'b>Room<'a, 'b> {
let y = (idx as i64) / width;
for template in templates {
- let mut obj = template.clone();
- obj.save = false;
- self.world.fetch_mut::<NewEntities>().templates.push((Pos{x, y}, obj));
+ self.world.fetch_mut::<NewEntities>().templates.push((Pos{x, y}, template.clone().unsaved()));
}
}
}
- pub fn view(&self) -> HashMap<String, WorldMessage> {
+ pub fn view(&self) -> HashMap<PlayerId, WorldMessage> {
self.world.fetch::<Output>().output.clone()
}