X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fcore%2Flevel%2Fmod.rs;fp=src%2Fcore%2Flevel%2Fmod.rs;h=84d4fad428720330d7d2a7f9e31282ee55e933c3;hb=b5332019b30abd70698c9cdd7b7b9d42502681c2;hp=5df8ba6e12640dba431e65c9c624e29ceb24fd79;hpb=d59c7f04922541543adb533ab07a26a781341777;p=kaka%2Frust-sdl-test.git diff --git a/src/core/level/mod.rs b/src/core/level/mod.rs index 5df8ba6..84d4fad 100644 --- a/src/core/level/mod.rs +++ b/src/core/level/mod.rs @@ -99,15 +99,13 @@ impl Level { pub fn intersect_walls(&self, p1: Point, p2: Point) -> IntersectResult { for c in self.wall_grid.grid_coordinates_on_line(p1, p2) { - if let walls = &self.wall_grid.cells[c.x][c.y] { - for w in walls { - if let Intersection::Point(p) = Intersection::lines(p1, p2, w.p1, w.p2) { - let wall = Wall { - region: &self.walls[w.region], - edge: w, - }; - return IntersectResult::Intersection(wall, p) - } + for w in &self.wall_grid.cells[c.x][c.y] { + if let Intersection::Point(p) = Intersection::lines(p1, p2, w.p1, w.p2) { + let wall = Wall { + region: &self.walls[w.region], + edge: w, + }; + return IntersectResult::Intersection(wall, p) } } }