summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-15 22:57:21 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-15 22:57:21 +0930
commit931f12cf9846fbd8cd2c4ae09c55aa359687b7b3 (patch)
treee45ae82eedab51c1285c7c2d1c8f25d6ca46ccf3
parentd7c7a5aa1f27d4be5531eaf3ba2e339e35344d6a (diff)
downloadfoxminesweeper-931f12cf9846fbd8cd2c4ae09c55aa359687b7b3.tar.gz
foxminesweeper-931f12cf9846fbd8cd2c4ae09c55aa359687b7b3.zip
remove flagging mines as win condition
-rw-r--r--Board.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Board.cpp b/Board.cpp
index 13a6238..2d2402b 100644
--- a/Board.cpp
+++ b/Board.cpp
@@ -216,9 +216,7 @@ Board::reveal_neighbor_tiles(int x, int y)
bool
Board::check_win()
{
- int allowedmines = minecount;
int safetiles = (height * width) - minecount;
- int correctflags = 0;
int correcttiles = 0;
for (int y = 0; y < height; y++)
@@ -226,12 +224,10 @@ Board::check_win()
for (int x = 0; x < width; x++)
{
Tile *tile = get_tile_at(x, y);
- if (tile->is_mine() && tile->is_flagged())
- correctflags++;
- else if (!(tile->is_mine()) && (tile->is_revealed()))
+ if (!(tile->is_mine()) && (tile->is_revealed()))
correcttiles++;
}
}
- return (correctflags == allowedmines) || (correcttiles == safetiles);
+ return (correcttiles == safetiles);
}