From 7de023fa3e0e4bcca4258ca62b056841e34de105 Mon Sep 17 00:00:00 2001 From: kfkama Date: Thu, 17 Feb 2022 16:30:00 +0100 Subject: [PATCH] Flagged cells will not be flooded --- src/main/java/Minesweeper/Cell.java | 2 +- src/main/java/Minesweeper/MinesweeperGame.java | 5 +---- src/main/java/Minesweeper/Playfield.java | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/Minesweeper/Cell.java b/src/main/java/Minesweeper/Cell.java index 9f6cc0c..d67ba5b 100644 --- a/src/main/java/Minesweeper/Cell.java +++ b/src/main/java/Minesweeper/Cell.java @@ -85,7 +85,7 @@ public class Cell extends JButton { } public void flood() { - if (type == CellType.Bomb) { + if (type == CellType.Bomb || flagged) { return; } diff --git a/src/main/java/Minesweeper/MinesweeperGame.java b/src/main/java/Minesweeper/MinesweeperGame.java index c3b9af4..9570e80 100644 --- a/src/main/java/Minesweeper/MinesweeperGame.java +++ b/src/main/java/Minesweeper/MinesweeperGame.java @@ -25,7 +25,4 @@ public class MinesweeperGame extends JPanel { f.setLayout(null); f.setVisible(true); } - - - -} +} \ No newline at end of file diff --git a/src/main/java/Minesweeper/Playfield.java b/src/main/java/Minesweeper/Playfield.java index 2a1806e..754dd52 100644 --- a/src/main/java/Minesweeper/Playfield.java +++ b/src/main/java/Minesweeper/Playfield.java @@ -134,4 +134,4 @@ public class Playfield { System.exit(0); } } -} +} \ No newline at end of file