diff options
Diffstat (limited to 'src/map/mod.rs')
| -rw-r--r-- | src/map/mod.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/map/mod.rs b/src/map/mod.rs index 2040706..e1def09 100644 --- a/src/map/mod.rs +++ b/src/map/mod.rs @@ -15,13 +15,13 @@ pub mod data; pub mod icon; pub mod icon_renderer; pub mod mappable; -pub mod polygon_room; +pub mod room; pub mod wall; pub use data::MapData; pub use icon::*; pub use mappable::Mappable; -pub use polygon_room::*; +pub use room::*; pub use wall::*; use crate::transform::Transform; @@ -32,7 +32,7 @@ use std::rc::Rc; /// The map containing all map elements that are seen on the screen. pub struct Map { - polygon_rooms: Vec<PolygonRoom>, + rooms: Vec<Room>, walls: Vec<Wall>, icons: Vec<Icon>, icon_renderer: Rc<IconRenderer>, @@ -42,7 +42,7 @@ impl Map { /// Create a new, empty map/world. pub fn new(rl: &mut RaylibHandle, rlt: &RaylibThread) -> Self { Self { - polygon_rooms: Vec::new(), + rooms: Vec::new(), walls: Vec::new(), icons: Vec::new(), icon_renderer: Rc::new(IconRenderer::new(rl, rlt)), @@ -51,8 +51,8 @@ impl Map { /// Add a room to the map. Currently, holes are not supported in the polygon, but this might /// change later. - pub fn push_polygon_room(&mut self, room_data: PolygonRoomData) { - self.polygon_rooms.push(PolygonRoom::from_data(room_data)); + pub fn push_room(&mut self, room_data: RoomData) { + self.rooms.push(Room::from_data(room_data)); } /// Add a wall to the world. @@ -104,7 +104,7 @@ impl Map { F: FnMut(&dyn Mappable) -> bool, { // Call retain on all vectors containing the maps actual types. - self.polygon_rooms.retain(|p| f(p as &dyn Mappable)); + self.rooms.retain(|p| f(p as &dyn Mappable)); self.walls.retain(|w| f(w as &dyn Mappable)); self.icons.retain(|i| f(i as &dyn Mappable)); } @@ -112,7 +112,7 @@ impl Map { /// Iterator over all elements as objects when an operation needs to go over all elements of the /// map. pub fn elements(&self) -> impl Iterator<Item = &dyn Mappable> { - self.polygon_rooms + self.rooms .iter() .map(|p| p as &dyn Mappable) .chain(self.walls.iter().map(|w| w as &dyn Mappable)) @@ -122,16 +122,16 @@ impl Map { /// Iterator over all elements, but the individual elements can be mutated. It is however /// impossible to add or remove elements in this way. For that, use the dedicated functions. pub fn elements_mut(&mut self) -> impl Iterator<Item = &mut dyn Mappable> { - self.polygon_rooms + self.rooms .iter_mut() .map(|p| p as &mut dyn Mappable) .chain(self.walls.iter_mut().map(|w| w as &mut dyn Mappable)) .chain(self.icons.iter_mut().map(|i| i as &mut dyn Mappable)) } - /// Get the polygon rooms of this map. - pub fn polygon_rooms(&self) -> &Vec<PolygonRoom> { - &self.polygon_rooms + /// Get the rooms of this map. + pub fn rooms(&self) -> &Vec<Room> { + &self.rooms } /// Get the walls of this map. @@ -148,7 +148,7 @@ impl Map { pub fn set_data(&mut self, data: MapData) { // Remove all data. self.icons.clear(); - self.polygon_rooms.clear(); + self.rooms.clear(); self.walls.clear(); // Add all data from the map data. @@ -161,8 +161,8 @@ impl Map { for i in data.icons { self.push_icon(Icon::from_data(i, self.icon_renderer.clone())) } - for p in data.polygon_rooms { - self.push_polygon_room(p); + for p in data.rooms { + self.push_room(p); } for w in data.walls { self.push_wall(w); |
