Skip to content

Commit caf29de

Browse files
committed
Don't draw incorrect flags at game end
1 parent 6aec059 commit caf29de

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

code/applications/mines.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,8 @@ static void show_game_state(struct MinesGameState *state) {
144144
draw_grid();
145145
for (uint8_t cell_y=0; cell_y < GRID_Y; cell_y++){
146146
for (uint8_t cell_x=0; cell_x < GRID_X; cell_x++){
147-
if (bitmatrix_get(state->flagged, cell_x, cell_y)
148-
|| (state->game_phase == m_END
149-
&& bitmatrix_get(state->mines, cell_x, cell_y))) {
147+
if ((state->game_phase != m_END && bitmatrix_get(state->flagged, cell_x, cell_y))
148+
|| (state->game_phase == m_END && bitmatrix_get(state->mines, cell_x, cell_y))) {
150149
draw_mine(cell_x, cell_y);
151150
} else if (state->game_phase != m_END && !bitmatrix_get(state->revealed, cell_x, cell_y)) {
152151
draw_hidden_cell(cell_x, cell_y);

0 commit comments

Comments
 (0)