diff --git a/src/main.rs b/src/main.rs index 106b1db..94d309d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -473,7 +473,7 @@ impl State { { let mut worldmap_resource = self.ecs.write_resource::(); *worldmap_resource = builder.get_map(); - player_start = builder.get_starting_position().as_mut().unwrap().clone(); + player_start = *builder.get_starting_position().as_mut().unwrap(); } // Spawn bad guys diff --git a/src/map_builders.rs b/src/map_builders.rs index 81a498f..81d2c91 100644 --- a/src/map_builders.rs +++ b/src/map_builders.rs @@ -22,7 +22,6 @@ use area_starting_points::{AreaStartingPosition, XStart, YStart}; use bsp_dungeon::BspDungeonBuilder; use bsp_interior::BspInteriorBuilder; use cellular_automata::CellularAutomataBuilder; -use common::*; use cull_unreachable::CullUnreachable; use distant_exit::DistantExit; use dla::DLABuilder; diff --git a/src/map_builders/bsp_dungeon.rs b/src/map_builders/bsp_dungeon.rs index cbc4a98..131cc48 100644 --- a/src/map_builders/bsp_dungeon.rs +++ b/src/map_builders/bsp_dungeon.rs @@ -1,9 +1,8 @@ use rltk::RandomNumberGenerator; -use crate::components::Position; use crate::map_builders::common::{apply_room_to_map, draw_corridor}; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, Rect, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::{Map, Rect, TileType}; pub struct BspDungeonBuilder { rects: Vec, diff --git a/src/map_builders/bsp_interior.rs b/src/map_builders/bsp_interior.rs index 9264f57..23050c0 100644 --- a/src/map_builders/bsp_interior.rs +++ b/src/map_builders/bsp_interior.rs @@ -1,10 +1,8 @@ use rltk::RandomNumberGenerator; -use super::MapBuilder; -use crate::components::Position; use crate::map_builders::common::draw_corridor; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, Rect, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::{Rect, TileType}; const MIN_ROOM_SIZE: i32 = 8; diff --git a/src/map_builders/cellular_automata.rs b/src/map_builders/cellular_automata.rs index e0809e4..0e055cf 100644 --- a/src/map_builders/cellular_automata.rs +++ b/src/map_builders/cellular_automata.rs @@ -1,13 +1,7 @@ -use std::collections::HashMap; - use rltk::RandomNumberGenerator; -use crate::components::Position; -use crate::map_builders::common::{ - generate_voronoi_spawn_regions, remove_unreachable_areas_returning_most_distant, -}; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::TileType; pub struct CellularAutomataBuilder {} diff --git a/src/map_builders/common.rs b/src/map_builders/common.rs index adac012..f1ae857 100644 --- a/src/map_builders/common.rs +++ b/src/map_builders/common.rs @@ -1,5 +1,4 @@ use std::cmp::{max, min}; -use std::collections::HashMap; use crate::{Map, Rect, TileType}; diff --git a/src/map_builders/cull_unreachable.rs b/src/map_builders/cull_unreachable.rs index 9342e54..652db85 100644 --- a/src/map_builders/cull_unreachable.rs +++ b/src/map_builders/cull_unreachable.rs @@ -18,7 +18,7 @@ impl CullUnreachable { } fn build(&mut self, _rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) { - let starting_pos = build_data.starting_position.as_ref().unwrap().clone(); + let starting_pos = *build_data.starting_position.as_ref().unwrap(); let start_idx = build_data.map.xy_idx(starting_pos.x, starting_pos.y); build_data.map.populate_blocked(); diff --git a/src/map_builders/distant_exit.rs b/src/map_builders/distant_exit.rs index 47a72c7..00d9ae0 100644 --- a/src/map_builders/distant_exit.rs +++ b/src/map_builders/distant_exit.rs @@ -18,7 +18,7 @@ impl DistantExit { } fn build(&mut self, _rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) { - let starting_pos = build_data.starting_position.as_ref().unwrap().clone(); + let starting_pos = *build_data.starting_position.as_ref().unwrap(); let start_idx = build_data.map.xy_idx(starting_pos.x, starting_pos.y); build_data.map.populate_blocked(); diff --git a/src/map_builders/dla.rs b/src/map_builders/dla.rs index 3e3bae8..94c97a5 100644 --- a/src/map_builders/dla.rs +++ b/src/map_builders/dla.rs @@ -1,15 +1,9 @@ -use std::collections::HashMap; - use rltk::RandomNumberGenerator; -use super::common::{ - generate_voronoi_spawn_regions, paint, remove_unreachable_areas_returning_most_distant, - Symmetry, -}; -use super::MapBuilder; +use super::common::{paint, Symmetry}; use crate::components::Position; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::TileType; #[derive(PartialEq, Copy, Clone)] pub enum DLAAlgorithm { diff --git a/src/map_builders/drunkard.rs b/src/map_builders/drunkard.rs index f32b3fb..69d93cd 100644 --- a/src/map_builders/drunkard.rs +++ b/src/map_builders/drunkard.rs @@ -1,15 +1,9 @@ -use std::collections::HashMap; - use rltk::RandomNumberGenerator; -use super::common::{ - generate_voronoi_spawn_regions, paint, remove_unreachable_areas_returning_most_distant, - Symmetry, -}; -use super::MapBuilder; +use super::common::{paint, Symmetry}; use crate::components::Position; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::TileType; #[derive(PartialEq, Copy, Clone)] pub enum DrunkSpawnMode { diff --git a/src/map_builders/maze.rs b/src/map_builders/maze.rs index 9202c1b..9b38529 100644 --- a/src/map_builders/maze.rs +++ b/src/map_builders/maze.rs @@ -1,13 +1,9 @@ use std::cmp::{max, min}; -use std::collections::HashMap; use rltk::RandomNumberGenerator; -use super::{ - generate_voronoi_spawn_regions, remove_unreachable_areas_returning_most_distant, MapBuilder, -}; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, Position, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::{Map, TileType}; pub struct MazeBuilder {} diff --git a/src/map_builders/prefab_builder.rs b/src/map_builders/prefab_builder.rs index 8805cc4..47b241b 100644 --- a/src/map_builders/prefab_builder.rs +++ b/src/map_builders/prefab_builder.rs @@ -7,7 +7,7 @@ use std::collections::HashSet; use rltk::RandomNumberGenerator; use crate::map_builders::{BuilderMap, InitialMapBuilder, MetaMapBuilder}; -use crate::{Map, Position, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::{Position, TileType}; #[derive(PartialEq, Copy, Clone)] #[allow(dead_code)] diff --git a/src/map_builders/simple_map.rs b/src/map_builders/simple_map.rs index 5572c53..ea09711 100644 --- a/src/map_builders/simple_map.rs +++ b/src/map_builders/simple_map.rs @@ -4,7 +4,7 @@ use crate::map_builders::common::{ apply_horizontal_tunnel, apply_room_to_map, apply_vertical_tunnel, }; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, Position, Rect, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::Rect; pub struct SimpleMapBuilder {} diff --git a/src/map_builders/voronoi.rs b/src/map_builders/voronoi.rs index f9d2950..91af8e1 100644 --- a/src/map_builders/voronoi.rs +++ b/src/map_builders/voronoi.rs @@ -1,10 +1,7 @@ -use std::collections::HashMap; - use rltk::RandomNumberGenerator; -use crate::components::Position; use crate::map_builders::{BuilderMap, InitialMapBuilder}; -use crate::{spawner, Map, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::TileType; #[derive(PartialEq, Copy, Clone)] #[allow(dead_code)] diff --git a/src/map_builders/voronoi_spawning.rs b/src/map_builders/voronoi_spawning.rs index 531317c..8cb6597 100644 --- a/src/map_builders/voronoi_spawning.rs +++ b/src/map_builders/voronoi_spawning.rs @@ -19,6 +19,7 @@ impl VoronoiSpawning { Box::new(VoronoiSpawning {}) } + #[allow(clippy::map_entry)] fn build(&mut self, rng: &mut RandomNumberGenerator, build_data: &mut BuilderMap) { let mut noise_areas: HashMap> = HashMap::new(); let mut noise = rltk::FastNoise::seeded(rng.roll_dice(1, 65536) as u64); diff --git a/src/map_builders/waveform_collapse.rs b/src/map_builders/waveform_collapse.rs index 1d95379..01df566 100644 --- a/src/map_builders/waveform_collapse.rs +++ b/src/map_builders/waveform_collapse.rs @@ -2,19 +2,13 @@ mod common; mod constraints; mod solver; -use std::collections::HashMap; - use common::*; use constraints::*; use rltk::RandomNumberGenerator; use solver::*; -use super::common::{ - generate_voronoi_spawn_regions, remove_unreachable_areas_returning_most_distant, -}; -use super::MapBuilder; use crate::map_builders::{BuilderMap, MetaMapBuilder}; -use crate::{spawner, Map, Position, TileType, SHOW_MAPGEN_VISUALIZER}; +use crate::Map; pub struct WaveformCollapseBuilder {}