From 2bf52e62dd5fcfa9ad6994492ffc4bf91ad183c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Mon, 14 Feb 2022 17:20:18 +0100 Subject: [PATCH] Simpler check for open doors --- rust/src/js_api.rs | 7 +------ rust/src/pathfinder.rs | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rust/src/js_api.rs b/rust/src/js_api.rs index 1334afc..42052f0 100644 --- a/rust/src/js_api.rs +++ b/rust/src/js_api.rs @@ -106,12 +106,7 @@ pub struct Wall { } impl Wall { - pub fn new( - p1: Point, - p2: Point, - door_type: DoorType, - door_state: DoorState, - ) -> Self { + pub fn new(p1: Point, p2: Point, door_type: DoorType, door_state: DoorState) -> Self { Self { p1, p2, diff --git a/rust/src/pathfinder.rs b/rust/src/pathfinder.rs index 36ba062..f778b30 100644 --- a/rust/src/pathfinder.rs +++ b/rust/src/pathfinder.rs @@ -156,6 +156,10 @@ impl Pathfinder { let mut endpoints = FxHashMap::>::default(); let mut line_segments = Vec::new(); for wall in walls { + if wall.is_door() && wall.is_open() { + continue; + } + // TODO Check if wall is ethereal let x_diff = wall.p2.x - wall.p1.x; let y_diff = wall.p2.y - wall.p1.y; let p1_angle = y_diff.atan2(x_diff);