diff --git a/src/visibility.rs b/src/visibility.rs index b2a0adf..c016f46 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -58,7 +58,7 @@ impl Viewshed { (start.x.abs() + self.range as f32 * 2.) as u32, (start.y.abs() + self.range as f32 * 2.) as u32, ); - let visibility_grid = VisibilityGrid(size, *viewer_entity, opacity_map.clone()); + let visibility_grid = VisibilityGrid(*viewer_entity, opacity_map.clone()); let mut new_visible = HashSet::new(); let mut new_visible_entities = HashSet::new(); // println!("Start: {viewer_entity}"); @@ -281,7 +281,7 @@ fn viewshed_removed( } } -pub struct VisibilityGrid(pub (u32, u32), pub Entity, pub OpacityMap); +struct VisibilityGrid(Entity, OpacityMap); impl InputGrid for VisibilityGrid { type Grid = (u32, u32); @@ -294,8 +294,8 @@ impl InputGrid for VisibilityGrid { fn get_opacity(&self, _grid: &Self::Grid, coord: Coord) -> Self::Opacity { // println!("Checking {coord:?}"); - if let Some((opacity, entities)) = self.2.get(&IVec2::new(coord.x, coord.y)) { - if entities.len() == 1 && entities.contains(&self.1) { + if let Some((opacity, entities)) = self.1.get(&IVec2::new(coord.x, coord.y)) { + if entities.contains(&self.0) { // println!("Hit viewer, 0"); 0 } else {