diff options
Diffstat (limited to 'src/map_data.rs')
| -rw-r--r-- | src/map_data.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/map_data.rs b/src/map_data.rs index e1a9c0b..b17d779 100644 --- a/src/map_data.rs +++ b/src/map_data.rs @@ -1,4 +1,4 @@ -use crate::math::{Rect, Vec2}; +use crate::math::{Polygon, Rect, Vec2}; use crate::tool::icon_tool::IconInfo; use ron::de::from_reader; use ron::ser::{to_string_pretty, PrettyConfig}; @@ -13,6 +13,7 @@ use std::path::Path; #[derive(Serialize, Deserialize)] pub struct MapData { rooms: Vec<Rect<f32>>, + polygons: Vec<Polygon<f32>>, walls: Vec<(Vec2<f32>, Vec2<f32>)>, icons: Vec<IconInfo>, } @@ -22,6 +23,7 @@ impl MapData { pub fn new() -> Self { Self { rooms: Vec::new(), + polygons: Vec::new(), walls: Vec::new(), icons: Vec::new(), } @@ -40,6 +42,7 @@ impl MapData { * future) */ self.rooms.append(&mut data.rooms); + self.polygons.append(&mut data.polygons); self.walls.append(&mut data.walls); self.icons.append(&mut data.icons); @@ -71,6 +74,13 @@ impl MapData { &mut self.rooms } + pub fn polygons(&self) -> &Vec<Polygon<f32>> { + &self.polygons + } + pub fn polygons_mut(&mut self) -> &mut Vec<Polygon<f32>> { + &mut self.polygons + } + pub fn walls(&self) -> &Vec<(Vec2<f32>, Vec2<f32>)> { &self.walls } |
