diff options
| author | troido <troido@protonmail.com> | 2020-02-09 00:49:57 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-09 00:49:57 +0100 |
| commit | d46bff6850237064cbfa90a54b4aca22170bbaf7 (patch) | |
| tree | 100177d22fcc5b6950b980c59eaafa193ba2d144 | |
| parent | 624b3a94b498d7410049d2227568534c118a9f7d (diff) | |
cleanup/rename makefloor to registernew
| -rw-r--r-- | src/room.rs | 4 | ||||
| -rw-r--r-- | src/systems/mod.rs | 2 | ||||
| -rw-r--r-- | src/systems/registernew.rs (renamed from src/systems/makefloor.rs) | 12 | ||||
| -rw-r--r-- | src/systems/view.rs | 12 |
4 files changed, 10 insertions, 20 deletions
diff --git a/src/room.rs b/src/room.rs index c179f61..30c420a 100644 --- a/src/room.rs +++ b/src/room.rs @@ -20,7 +20,7 @@ use super::resources::{ }; use super::systems::{ moving::Move, - makefloor::MakeFloor, + registernew::RegisterNew, controlinput::ControlInput, view::View, remove::Remove, @@ -45,7 +45,7 @@ impl <'a, 'b>Room<'a, 'b> { let mut dispatcher = DispatcherBuilder::new() .with(ControlInput, "controlinput", &[]) - .with(MakeFloor::default(), "makefloor", &[]) + .with(RegisterNew::default(), "makefloor", &[]) .with(Move, "move", &["makefloor", "controlinput"]) .with(View::default(), "view", &["move"]) .with(Create, "create", &["view", "controlinput"]) diff --git a/src/systems/mod.rs b/src/systems/mod.rs index a4dd473..60fd106 100644 --- a/src/systems/mod.rs +++ b/src/systems/mod.rs @@ -1,7 +1,7 @@ // pub mod clearcontrols; pub mod controlinput; -pub mod makefloor; +pub mod registernew; pub mod moving; pub mod view; pub mod remove; diff --git a/src/systems/makefloor.rs b/src/systems/registernew.rs index 689fcec..c6b18fa 100644 --- a/src/systems/makefloor.rs +++ b/src/systems/registernew.rs @@ -11,9 +11,7 @@ use specs::{ use crate::components::{ Position, - New, - Moved, - Removed + New }; use crate::resources::{ @@ -22,17 +20,15 @@ use crate::resources::{ #[derive(Default)] -pub struct MakeFloor; -impl <'a> System<'a> for MakeFloor { +pub struct RegisterNew; +impl <'a> System<'a> for RegisterNew { type SystemData = ( Entities<'a>, Write<'a, Ground>, ReadStorage<'a, Position>, ReadStorage<'a, New>, - ReadStorage<'a, Moved>, - ReadStorage<'a, Removed> ); - fn run(&mut self, (entities, mut ground, positions, new, moved, removed): Self::SystemData) { + fn run(&mut self, (entities, mut ground, positions, new): Self::SystemData) { for (ent, pos, _new) in (&entities, &positions, &new).join() { ground.cells.entry(pos.pos).or_insert(HashSet::new()).insert(ent); } diff --git a/src/systems/view.rs b/src/systems/view.rs index 79078f4..6c0b1f8 100644 --- a/src/systems/view.rs +++ b/src/systems/view.rs @@ -2,13 +2,7 @@ use std::collections::{HashMap, HashSet}; use specs::{ - BitSet, - storage::ComponentEvent, - ReaderId, - World, - SystemData, ReadStorage, - WriteStorage, Read, Write, System, @@ -32,14 +26,14 @@ impl <'a> System<'a> for View { ReadStorage<'a, Position>, ReadStorage<'a, Visible>, Read<'a, Size>, - WriteStorage<'a, Player>, + ReadStorage<'a, Player>, Write<'a, Output>, ReadStorage<'a, New>, ReadStorage<'a, Moved>, ReadStorage<'a, Removed>, Read<'a, Ground> ); - fn run(&mut self, (entities, positions, visible, size, mut players, mut output, new, moved, removed, ground): Self::SystemData) { + fn run(&mut self, (entities, positions, visible, size, players, mut output, new, moved, removed, ground): Self::SystemData) { let mut changed = HashSet::new(); for (pos, _new) in (&positions, &new).join() { @@ -64,7 +58,7 @@ impl <'a> System<'a> for View { output.output.clear(); - for (ent, mut player, pos) in (&entities, &mut players, &positions).join() { + for (ent, player, pos) in (&entities, &players, &positions).join() { let mut updates: Vec<WorldUpdate> = Vec::new(); if new.get(ent).is_some() { let (values, mapping) = draw_room(&ground.cells, (size.width, size.height), &visible); |
