|
@@ -157,7 +157,9 @@ pub struct Viewshed<T> {
|
|
|
|
|
|
impl<T> Viewshed<T> {
|
|
|
pub fn create(original: &Board<T>, blocking: fn(&T) -> bool) -> Viewshed<T> {
|
|
|
- let vis = Board::new_from(original.width(), original.height(), |_, _| Visibility::Unseen);
|
|
|
+ let vis = Board::new_from(original.width(), original.height(), |_, _| {
|
|
|
+ Visibility::Unseen
|
|
|
+ });
|
|
|
let blocking = Box::new(blocking);
|
|
|
Viewshed { vis, blocking }
|
|
|
}
|
|
@@ -219,7 +221,7 @@ impl<T> Viewshed<T> {
|
|
|
|
|
|
#[cfg(test)]
|
|
|
mod test {
|
|
|
- use crate::{Board, Coord, Visibility, Viewshed};
|
|
|
+ use crate::{Board, Coord, Viewshed, Visibility};
|
|
|
|
|
|
macro_rules! board_from_vec {
|
|
|
($w:expr, $h:expr; [$($vec:tt)*]) => {
|
|
@@ -325,7 +327,6 @@ mod test {
|
|
|
];
|
|
|
assert_eq!(v.vis, exp);
|
|
|
|
|
|
-
|
|
|
v.calculate_from(&b, Coord::new(4, 2));
|
|
|
let exp: Board<Visibility> = board_from_vec![
|
|
|
7,5;
|