summaryrefslogtreecommitdiff
path: root/src/map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.rs')
-rw-r--r--src/map.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/map.rs b/src/map.rs
index 8ef6f4e..124125a 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -61,7 +61,7 @@ impl Map {
})
.collect();
- let spawns = Map::get_spawn_points(&layers, tileset.get_spawn_tiles());
+ let spawns = Map::find_spawn_points(&layers, tileset.get_spawn_tiles());
Map {
layers,
@@ -70,7 +70,7 @@ impl Map {
}
}
- fn get_spawn_points(
+ fn find_spawn_points(
layers: &[Layer],
spawn_tiles: HashMap<usize, Tile>,
) -> Vec<(String, Point2<f32>)> {
@@ -90,8 +90,13 @@ impl Map {
spawn_points
}
- pub fn get_spawns(&self) -> Vec<(String, Point2<f32>)> {
- self.spawns.clone()
+ pub fn get_spawn_points(&self, name: &str) -> Vec<Point2<f32>> {
+ self.spawns
+ .clone()
+ .into_iter()
+ .filter(|s| s.0 == name)
+ .map(|s| s.1)
+ .collect()
}
pub fn get_dimensions(&self) -> (f32, f32) {