Skip to content

Commit d1bcb7d

Browse files
committed
comments, minor cleanup
1 parent c5d9360 commit d1bcb7d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

minesweeper.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ static bool game_won(Minesweeper* minesweeper_state) {
305305
dialog_message_set_header(message, header_text, 64, 3, AlignCenter, AlignTop);
306306
dialog_message_set_text(message, furi_string_get_cstr(tempStr), 64, 32, AlignCenter, AlignCenter);
307307
dialog_message_set_buttons(message, NULL, "Play again", NULL);
308-
// TODO: create icon
309308
dialog_message_set_icon(message, NULL, 72, 17);
310309

311310
DialogMessageButton choice = dialog_message_show(dialogs, message);
@@ -317,7 +316,6 @@ static bool game_won(Minesweeper* minesweeper_state) {
317316

318317
// returns false if the move loses the game - otherwise true
319318
static bool play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y) {
320-
TileType tile = minesweeper_state->playfield[cursor_x][cursor_y]
321319
if (minesweeper_state->playfield[cursor_x][cursor_y] == TileTypeFlag) {
322320
// we're on a flagged field, do nothing
323321
return true;
@@ -363,16 +361,13 @@ static bool play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y
363361
}
364362
}
365363
}
366-
}
364+
}
367365
// we're done without hitting a mine - so return
368366
return true;
369367
}
370368
}
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.
376371
int hint = 0;
377372
for (int y = cursor_y-1; y <= cursor_y+1; y++) {
378373
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
393388
minesweeper_state->fields_cleared++;
394389
FURI_LOG_D("Minesweeper", "Setting %d,%d to %d", cursor_x, cursor_y, hint);
395390
if (hint == 0) {
391+
// the field is "empty"
396392
// auto open surrounding fields.
397393
for (int auto_y = cursor_y-1; auto_y <= cursor_y+1; auto_y++) {
398394
for (int auto_x = cursor_x-1; auto_x <= cursor_x+1; auto_x++) {

0 commit comments

Comments
 (0)