From a336ae94203f1e462b70517fa6d54216fe6c2534 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 24 Jul 2022 19:11:02 +0200 Subject: [PATCH] Fix find_unconnected_ports --- src/matrix.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/matrix.rs b/src/matrix.rs index 6dd169e..21653b7 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -401,8 +401,10 @@ impl Cell { }; for dir in options { - if let Some(pos) = self.is_port_dir_connected(m, *dir) { - unused_ports.push((*dir, pos)); + if self.is_port_dir_connected(m, *dir).is_none() { + if let Some(pos) = dir.offs_pos((self.x as usize, self.y as usize)) { + unused_ports.push((*dir, pos)); + } } }