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()) {
|
||||
floodedCells.clear();
|
||||
}
|
||||
if(floodedFlaggedCellsCounter != 0) {
|
||||
floodedFlaggedCellsCounter = 0;
|
||||
}
|
||||
resetFloodedFlaggedCellCounter();
|
||||
flood(cell);
|
||||
checkWinCondition();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
resetFloodedFlaggedCellCounter();
|
||||
cell.setRevealed();
|
||||
state[x][y] = cell;
|
||||
checkWinCondition();
|
||||
|
|
@ -173,6 +172,12 @@ public class Game {
|
|||
board.draw(state, tilemap);
|
||||
}
|
||||
|
||||
private void resetFloodedFlaggedCellCounter() {
|
||||
if(floodedFlaggedCellsCounter > 0) {
|
||||
floodedFlaggedCellsCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void flood(Cell cell) {
|
||||
if(cell.isRevealed()) 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