floodedflaggedcellscounter now gets resettet at number cells too
This commit is contained in:
parent
7355c2e0df
commit
cb1dfca31c
1 changed files with 8 additions and 3 deletions
|
|
@ -155,14 +155,13 @@ public class Game {
|
||||||
if(!floodedCells.isEmpty()) {
|
if(!floodedCells.isEmpty()) {
|
||||||
floodedCells.clear();
|
floodedCells.clear();
|
||||||
}
|
}
|
||||||
if(floodedFlaggedCellsCounter != 0) {
|
resetFloodedFlaggedCellCounter();
|
||||||
floodedFlaggedCellsCounter = 0;
|
|
||||||
}
|
|
||||||
flood(cell);
|
flood(cell);
|
||||||
checkWinCondition();
|
checkWinCondition();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
resetFloodedFlaggedCellCounter();
|
||||||
cell.setRevealed();
|
cell.setRevealed();
|
||||||
state[x][y] = cell;
|
state[x][y] = cell;
|
||||||
checkWinCondition();
|
checkWinCondition();
|
||||||
|
|
@ -173,6 +172,12 @@ public class Game {
|
||||||
board.draw(state, tilemap);
|
board.draw(state, tilemap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resetFloodedFlaggedCellCounter() {
|
||||||
|
if(floodedFlaggedCellsCounter > 0) {
|
||||||
|
floodedFlaggedCellsCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void flood(Cell cell) {
|
public void flood(Cell cell) {
|
||||||
if(cell.isRevealed()) return;
|
if(cell.isRevealed()) return;
|
||||||
if(cell.getType() == Cell.CellType.Mine || cell.getType() == Cell.CellType.Invalid || cell.position == null) return;
|
if(cell.getType() == Cell.CellType.Mine || cell.getType() == Cell.CellType.Invalid || cell.position == null) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue