From 7074a8c0075fd89f1d6a8376025b292702aac9f3 Mon Sep 17 00:00:00 2001 From: Guillaume Pasquet Date: Mon, 9 Mar 2020 21:55:45 +0000 Subject: Fix LOS --- src/tiling.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tiling.rs b/src/tiling.rs index a48d57e..c121eb4 100644 --- a/src/tiling.rs +++ b/src/tiling.rs @@ -130,10 +130,6 @@ impl TileGrid { self.reveal(start.0, start.1); loop { - if let TileType::Empty = self.tile_at(x, y).get_type() { - break; - } - if x == end.0 && y == end.1 { // self.reveal(x, y); break; @@ -148,6 +144,11 @@ impl TileGrid { err += dx; y = (y as isize + sy).max(0) as usize; } + + if let TileType::Empty = self.tile_at(x, y).get_type() { + break; + } + self.reveal(x, y); } } -- cgit v1.2.3