summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index bab21a0..f0a7eb6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -414,9 +414,9 @@ fn mouse_system(
if let Some(mut selected) = cells.clone().iter_mut().find(|c| c.selected) {
if let Some(mut hovered) = cells.iter_mut().find(|c| c.hovered) {
if (selected.x == hovered.x + 1 && selected.y == hovered.y)
- || (selected.x == hovered.x - 1 && selected.y == hovered.y)
+ || (selected.x == hovered.x.overflowing_sub(1).0 && selected.y == hovered.y)
|| (selected.y == hovered.y + 1 && selected.x == hovered.x)
- || (selected.y == hovered.y - 1 && selected.x == hovered.x)
+ || (selected.y == hovered.y.overflowing_sub(1).0 && selected.x == hovered.x)
{
let tmp = selected.occupant;
selected.occupant = hovered.occupant;