Merge branch 'quit-bugfix': proper fix for the gameover/win conditions

This commit is contained in:
thorium1256 2025-06-27 15:43:40 +03:00
commit cf2fa8a9c2

View File

@ -255,12 +255,15 @@ void startGame(Board &board)
mvprintw(1, 8, "%s", tim); mvprintw(1, 8, "%s", tim);
attroff(COLOR_PAIR(3)); attroff(COLOR_PAIR(3));
refresh(); refresh();
while ((c = getch()) != 'q') while (true)
{ {
c = getch();
if (c == 'r') if (c == 'r')
{ {
Board newBoard(boardSize.x, boardSize.y, board.getMineCount()); Board newBoard(boardSize.x, boardSize.y, board.getMineCount());
startGame(newBoard); startGame(newBoard);
} else if(c == 'q') {
exit(0);
} }
}; };
} }
@ -279,12 +282,15 @@ void startGame(Board &board)
attroff(COLOR_PAIR(3)); attroff(COLOR_PAIR(3));
refresh(); refresh();
int c; int c;
while ((c = getch()) != 'q') while (true)
{ {
c = getch();
if (c == 'r') if (c == 'r')
{ {
Board newBoard(boardSize.x, boardSize.y, board.getMineCount()); Board newBoard(boardSize.x, boardSize.y, board.getMineCount());
startGame(newBoard); startGame(newBoard);
} else if(c == 'q') {
exit(0);
} }
}; };
} }