1 | /* ncurses-minesweeper Copyright (c) 2020 Joshua 'joshuas3' Stockin |
2 | * <https://joshstock.in> |
3 | * <https://github.com/JoshuaS3/ncurses-minesweeper> |
4 | * |
5 | * This software is licensed and distributed under the terms of the MIT License. |
6 | * See the MIT License in the LICENSE file of this project's root folder. |
7 | * |
8 | * This comment block and its contents, including this disclaimer, MUST be |
9 | * preserved in all copies or distributions of this software's source. |
10 | */ |
11 |
|
12 | #include <ncurses.h> |
13 |
|
14 | #include "../state.h" |
15 |
|
16 | void check_done(game_board *board) { |
17 | for (int i = 0; i < board->width * board->height; i++) { |
18 | game_board_cell *cell = &board->cells[i]; |
19 | if (!cell->opened && !cell->is_bomb) { |
20 | return; // missed good cell(s), not done! |
21 | } |
22 | } |
23 | board->status = Done; // no missing good cells, done |
24 | flash(); |
25 | } |
26 |
|