use {point, time_scope};
-use common::Point2D;
+use common::Point;
use super::{Grid, Level};
use noise::{NoiseFn, OpenSimplex, Seedable};
use rand::Rng;
}
}
- fn find_walls(&self, grid: &Grid) -> Vec<Vec<Point2D<isize>>> {
+ fn find_walls(&self, grid: &Grid) -> Vec<Vec<Point<isize>>> {
let mut walls = vec!();
for r in self.find_regions(&grid) {
if r.value {
(min.0, min.1, 1 + max.0 - min.0, 1 + max.1 - min.1)
}
- pub fn outline(&self, scale: usize) -> Vec<Point2D<isize>> {
+ pub fn outline(&self, scale: usize) -> Vec<Point<isize>> {
let rect = self.enclosing_rect();
let (ox, oy, w, h) = rect;
let grid = self.grid(&rect);
grid
}
- fn find_first_point_of_outline(&self, rect: &(usize, usize, usize, usize), grid: &Vec<Vec<bool>>) -> Point2D<isize> {
+ fn find_first_point_of_outline(&self, rect: &(usize, usize, usize, usize), grid: &Vec<Vec<bool>>) -> Point<isize> {
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 {
panic!("no wall found!");
}
- fn find_next_point_of_outline(&self, grid: &Vec<Vec<bool>>, p: &mut Point2D<isize>, directions: &mut Vec<(isize, isize)>) {
+ fn find_next_point_of_outline(&self, grid: &Vec<Vec<bool>>, p: &mut Point<isize>, directions: &mut Vec<(isize, isize)>) {
directions.rotate_left(2);
loop {
let d = directions[0];
}
}
- fn check(&self, p: Point2D<isize>, grid: &Vec<Vec<bool>>) -> bool {
+ fn check(&self, p: Point<isize>, grid: &Vec<Vec<bool>>) -> bool {
if p.x < 0 || p.x >= grid.len() as isize || p.y < 0 || p.y >= grid[0].len() as isize {
false
} else {