@@ -305,7 +305,6 @@ static bool game_won(Minesweeper* minesweeper_state) {
305
305
dialog_message_set_header (message , header_text , 64 , 3 , AlignCenter , AlignTop );
306
306
dialog_message_set_text (message , furi_string_get_cstr (tempStr ), 64 , 32 , AlignCenter , AlignCenter );
307
307
dialog_message_set_buttons (message , NULL , "Play again" , NULL );
308
- // TODO: create icon
309
308
dialog_message_set_icon (message , NULL , 72 , 17 );
310
309
311
310
DialogMessageButton choice = dialog_message_show (dialogs , message );
@@ -317,7 +316,6 @@ static bool game_won(Minesweeper* minesweeper_state) {
317
316
318
317
// returns false if the move loses the game - otherwise true
319
318
static bool play_move (Minesweeper * minesweeper_state , int cursor_x , int cursor_y ) {
320
- TileType tile = minesweeper_state -> playfield [cursor_x ][cursor_y ]
321
319
if (minesweeper_state -> playfield [cursor_x ][cursor_y ] == TileTypeFlag ) {
322
320
// we're on a flagged field, do nothing
323
321
return true;
@@ -363,16 +361,13 @@ static bool play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y
363
361
}
364
362
}
365
363
}
366
- }
364
+ }
367
365
// we're done without hitting a mine - so return
368
366
return true;
369
367
}
370
368
}
371
- //if (minesweeper_state->playfield[cursor_x][cursor_y] != TileTypeUncleared) {
372
- // // we're on an already uncovered field
373
- // return true;
374
- //}
375
- // get number of surrounding mines.
369
+
370
+ // calculate number of surrounding mines.
376
371
int hint = 0 ;
377
372
for (int y = cursor_y - 1 ; y <= cursor_y + 1 ; y ++ ) {
378
373
for (int x = cursor_x - 1 ; x <= cursor_x + 1 ; x ++ ) {
@@ -393,6 +388,7 @@ static bool play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y
393
388
minesweeper_state -> fields_cleared ++ ;
394
389
FURI_LOG_D ("Minesweeper" , "Setting %d,%d to %d" , cursor_x , cursor_y , hint );
395
390
if (hint == 0 ) {
391
+ // the field is "empty"
396
392
// auto open surrounding fields.
397
393
for (int auto_y = cursor_y - 1 ; auto_y <= cursor_y + 1 ; auto_y ++ ) {
398
394
for (int auto_x = cursor_x - 1 ; auto_x <= cursor_x + 1 ; auto_x ++ ) {
0 commit comments