Skip to content

Commit

Permalink
some sanity checks... theres a bug with spammed inputs :(
Browse files Browse the repository at this point in the history
  • Loading branch information
panki27 committed Sep 23, 2022
1 parent f951a55 commit 5dbbd04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions minesweeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ static void setup_playfield(Minesweeper* minesweeper_state) {
minesweeper_state->flags_set = 0;
minesweeper_state->game_started_tick = furi_get_tick();
minesweeper_state->game_started = false;
minesweeper_state->showing_dialog = false;
}
}

Expand Down Expand Up @@ -275,7 +276,6 @@ static bool game_lost(Minesweeper* minesweeper_state) {

DialogMessageButton choice = dialog_message_show(dialogs, message);
dialog_message_free(message);
minesweeper_state->showing_dialog = false;
furi_record_close(RECORD_NOTIFICATION);

return choice == DialogMessageButtonCenter;
Expand Down Expand Up @@ -307,7 +307,7 @@ static bool game_won(Minesweeper* minesweeper_state) {

DialogMessageButton choice = dialog_message_show(dialogs, message);
dialog_message_free(message);
minesweeper_state->showing_dialog = false;
//minesweeper_state->showing_dialog = false;
string_clear(tempStr);
string_reset(tempStr);
furi_record_close(RECORD_DIALOGS);
Expand Down Expand Up @@ -404,6 +404,12 @@ int32_t minesweeper_app(void* p) {
for (bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
Minesweeper* minesweeper_state = (Minesweeper*)acquire_mutex_block(&state_mutex);
if (minesweeper_state->showing_dialog) {
// this should not happen.
//release_mutex(&state_mutex, minesweeper_state);
processing = false;
//continue;
}
if(event_status == FuriStatusOk) {
// press events
if(event.type == EventTypeKey) {
Expand Down

0 comments on commit 5dbbd04

Please sign in to comment.