X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fcore%2Flevel%2Flvlgen.rs;fp=src%2Fcore%2Flevel%2Flvlgen.rs;h=8cdf6df897846bc606513e48d57fa31ac7b363ff;hb=0c56b1f7a5568d6bfbebd196cf63ccef503cf959;hp=daf27e83187d0081ee0bd08cac0b4e6ca546daa8;hpb=7b724ff393ea83b7a2d43fbfa93199d0c395af92;p=kaka%2Frust-sdl-test.git diff --git a/src/core/level/lvlgen.rs b/src/core/level/lvlgen.rs index daf27e8..8cdf6df 100644 --- a/src/core/level/lvlgen.rs +++ b/src/core/level/lvlgen.rs @@ -118,7 +118,7 @@ impl LevelGenerator { println!(" {} iterations needed", count); } - fn neighbours(&self, grid: &Vec>, px: usize, py: usize, distance: usize) -> u8 { + fn neighbours(&self, grid: &[Vec], px: usize, py: usize, distance: usize) -> u8 { let mut count = 0; for x in (px - distance)..=(px + distance) { for y in (py - distance)..=(py + distance) { @@ -292,7 +292,7 @@ impl Region { } #[allow(dead_code)] - fn print_grid(&self, grid: &Vec>) { + fn print_grid(&self, grid: &[Vec]) { let w = grid.len(); let h = grid[0].len(); let mut g = vec!(vec!(false; w); h); @@ -325,7 +325,7 @@ impl Region { grid } - fn find_first_point_of_outline(&self, rect: &(usize, usize, usize, usize), grid: &Vec>) -> Point { + fn find_first_point_of_outline(&self, rect: &(usize, usize, usize, usize), grid: &[Vec]) -> Point { let (ox, oy, w, h) = rect; let is_outer_wall = (ox, oy) == (&0, &0); // we know this is always the outer wall of the level for x in 0..*w { @@ -341,7 +341,7 @@ impl Region { panic!("no wall found!"); } - fn find_next_point_of_outline(&self, grid: &Vec>, p: &mut Point, directions: &mut Vec<(isize, isize)>) { + fn find_next_point_of_outline(&self, grid: &[Vec], p: &mut Point, directions: &mut Vec<(isize, isize)>) { directions.rotate_left(2); loop { let d = directions[0]; @@ -353,7 +353,7 @@ impl Region { } } - fn check(&self, p: Point, grid: &Vec>) -> bool { + fn check(&self, p: Point, grid: &[Vec]) -> bool { if p.x < 0 || p.x >= grid.len() as isize || p.y < 0 || p.y >= grid[0].len() as isize { false } else {