| 52 | } |
| 53 | |
| 54 | void CheckWin(){ |
| 55 | unflaggedMines = 0; |
| 56 | for(int i = 0; i < mapSize.y; i++){ |
| 57 | for(int j = 0; j < mapSize.x; j++){ |
| 58 | Tile& tile = tiles[i][j]; |
| 59 | |
| 60 | if(tile.type == MineTile && !tile.flagged){ |
| 61 | unflaggedMines++; |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | if(unflaggedMines){ |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | window->Paint(); |
| 72 | Lemon::GUI::DisplayMessageBox("Minesweeper", "You Win!"); |
| 73 | |
| 74 | Generate(difficulty); |
| 75 | } |
| 76 | public: |
| 77 | MinesweeperGame(int diff) : Widget({0,0,0,0}){ |
| 78 | Generate(diff); |
nothing calls this directly
no test coverage detected