From 53f358f73c37e86f4db9e7bd7af309697dc7237e Mon Sep 17 00:00:00 2001 From: troido Date: Mon, 3 Feb 2020 20:16:09 +0100 Subject: only send changed cells, not the whole field each time --- src/room.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/room.rs') diff --git a/src/room.rs b/src/room.rs index da92d69..8341eba 100644 --- a/src/room.rs +++ b/src/room.rs @@ -12,6 +12,7 @@ use specs::{ use super::controls::Action; use super::pos::Pos; +use super::components::Position; use super::assemblages::Assemblage; use super::worldmessages::WorldMessage; use super::resources::{ @@ -49,7 +50,7 @@ impl <'a, 'b>Room<'a, 'b> { .with(MakeFloor, "makefloor", &[]) .with(Move, "move", &["makefloor", "controlinput"]) .with(ClearControllers, "clearcontrollers", &["move"]) - .with(View, "view", &["move"]) + .with(View::default(), "view", &["move"]) .build(); dispatcher.setup(&mut world); @@ -69,7 +70,7 @@ impl <'a, 'b>Room<'a, 'b> { let assemblages = self.world.remove::().unwrap_or(NewEntities{assemblages: Vec::new()}).assemblages; self.world.insert(NewEntities{assemblages: Vec::new()}); for (pos, assemblage) in assemblages{ - assemblage.build(self.world.create_entity()).with(pos).build(); + assemblage.build(self.world.create_entity()).with(Position::new(pos)).build(); } self.world.maintain(); } @@ -84,7 +85,7 @@ impl <'a, 'b>Room<'a, 'b> { } pub fn add_obj(&mut self, template: &dyn Assemblage, (x, y): (i32, i32)) -> Entity { - template.build(self.world.create_entity()).with(Pos{x, y}).build() + template.build(self.world.create_entity()).with(Position::new(Pos{x, y})).build() } } -- cgit