|
@@ -149,9 +149,7 @@ 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(), |_, _| {
|
|
|
- false
|
|
|
- });
|
|
|
+ let vis = Board::new_from(original.width(), original.height(), |_, _| false);
|
|
|
let blocking = Box::new(blocking);
|
|
|
Viewshed { vis, blocking }
|
|
|
}
|
|
@@ -232,7 +230,11 @@ mod test {
|
|
|
|
|
|
fn assert_same_vis(p: Coord, exp: &Board<bool>, actual: &Board<bool>) {
|
|
|
if exp != actual {
|
|
|
- panic!("Expected:\n{}\n========\nActual:\n{}\n", to_vis(p, exp), to_vis(p, actual));
|
|
|
+ panic!(
|
|
|
+ "Expected:\n{}\n========\nActual:\n{}\n",
|
|
|
+ to_vis(p, exp),
|
|
|
+ to_vis(p, actual)
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -305,7 +307,6 @@ mod test {
|
|
|
|
|
|
line.add(super::Shadow::new(0.6, 1.0));
|
|
|
assert_eq!(line.shadows.len(), 1);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
fn to_vis(p: Coord, vis: &super::Board<bool>) -> String {
|
|
@@ -316,7 +317,7 @@ mod test {
|
|
|
buf.push('@')
|
|
|
} else {
|
|
|
buf.push(match vis[(x, y)] {
|
|
|
- true => '#',
|
|
|
+ true => '#',
|
|
|
false => '.',
|
|
|
})
|
|
|
}
|