diff options
| author | troido <troido@protonmail.com> | 2020-02-03 20:16:09 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-03 20:16:09 +0100 |
| commit | 53f358f73c37e86f4db9e7bd7af309697dc7237e (patch) | |
| tree | d118cdfb10e1519995a92ac0c58db1051c41325d /src/systems/makefloor.rs | |
| parent | 30509956d4274b2565052dc045eec3742a159357 (diff) | |
only send changed cells, not the whole field each time
Diffstat (limited to 'src/systems/makefloor.rs')
| -rw-r--r-- | src/systems/makefloor.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/systems/makefloor.rs b/src/systems/makefloor.rs index b6fedd9..209d965 100644 --- a/src/systems/makefloor.rs +++ b/src/systems/makefloor.rs @@ -8,7 +8,7 @@ use specs::{ Join }; -use super::super::pos::Pos; +use super::super::components::Position; use super::super::resources::{ Floor @@ -17,11 +17,11 @@ use super::super::resources::{ pub struct MakeFloor; impl <'a> System<'a> for MakeFloor { - type SystemData = (Entities<'a>, Write<'a, Floor>, ReadStorage<'a, Pos>); + type SystemData = (Entities<'a>, Write<'a, Floor>, ReadStorage<'a, Position>); fn run(&mut self, (entities, mut floor, positions): Self::SystemData) { floor.cells.clear(); for (ent, pos) in (&entities, &positions).join() { - floor.cells.entry(*pos).or_insert(Vec::new()).push(ent); + floor.cells.entry(pos.pos).or_insert(Vec::new()).push(ent); } } } |
