aboutsummaryrefslogtreecommitdiff
path: root/src/map/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mod.rs')
-rw-r--r--src/map/mod.rs35
1 files changed, 4 insertions, 31 deletions
diff --git a/src/map/mod.rs b/src/map/mod.rs
index 70f65b3..2040706 100644
--- a/src/map/mod.rs
+++ b/src/map/mod.rs
@@ -16,14 +16,12 @@ pub mod icon;
pub mod icon_renderer;
pub mod mappable;
pub mod polygon_room;
-pub mod rect_room;
pub mod wall;
pub use data::MapData;
pub use icon::*;
pub use mappable::Mappable;
pub use polygon_room::*;
-pub use rect_room::*;
pub use wall::*;
use crate::transform::Transform;
@@ -34,7 +32,6 @@ use std::rc::Rc;
/// The map containing all map elements that are seen on the screen.
pub struct Map {
- rect_rooms: Vec<RectRoom>,
polygon_rooms: Vec<PolygonRoom>,
walls: Vec<Wall>,
icons: Vec<Icon>,
@@ -45,7 +42,6 @@ impl Map {
/// Create a new, empty map/world.
pub fn new(rl: &mut RaylibHandle, rlt: &RaylibThread) -> Self {
Self {
- rect_rooms: Vec::new(),
polygon_rooms: Vec::new(),
walls: Vec::new(),
icons: Vec::new(),
@@ -53,13 +49,6 @@ impl Map {
}
}
- /// Add a rectangularly shaped room to the world. Since the polygon room tool was added, and
- /// afaik rects are polygon rooms, this will be phased out in favour of only having polygon
- /// rooms, which will then become just normal rooms.
- pub fn push_rect_room(&mut self, room_data: RectRoomData) {
- self.rect_rooms.push(RectRoom::from_data(room_data));
- }
-
/// 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) {
@@ -115,7 +104,6 @@ impl Map {
F: FnMut(&dyn Mappable) -> bool,
{
// Call retain on all vectors containing the maps actual types.
- self.rect_rooms.retain(|r| f(r as &dyn Mappable));
self.polygon_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));
@@ -124,10 +112,9 @@ 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.rect_rooms
+ self.polygon_rooms
.iter()
- .map(|r| r as &dyn Mappable)
- .chain(self.polygon_rooms.iter().map(|p| p as &dyn Mappable))
+ .map(|p| p as &dyn Mappable)
.chain(self.walls.iter().map(|w| w as &dyn Mappable))
.chain(self.icons.iter().map(|i| i as &dyn Mappable))
}
@@ -135,23 +122,13 @@ 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.rect_rooms
+ self.polygon_rooms
.iter_mut()
- .map(|r| r as &mut dyn Mappable)
- .chain(
- self.polygon_rooms
- .iter_mut()
- .map(|p| p as &mut dyn Mappable),
- )
+ .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 rectangular rooms of this map.
- pub fn rect_rooms(&self) -> &Vec<RectRoom> {
- &self.rect_rooms
- }
-
/// Get the polygon rooms of this map.
pub fn polygon_rooms(&self) -> &Vec<PolygonRoom> {
&self.polygon_rooms
@@ -172,7 +149,6 @@ impl Map {
// Remove all data.
self.icons.clear();
self.polygon_rooms.clear();
- self.rect_rooms.clear();
self.walls.clear();
// Add all data from the map data.
@@ -188,9 +164,6 @@ impl Map {
for p in data.polygon_rooms {
self.push_polygon_room(p);
}
- for r in data.rect_rooms {
- self.push_rect_room(r);
- }
for w in data.walls {
self.push_wall(w);
}