From 5acbf5415ced0023becc1151d00fc628706eb96a Mon Sep 17 00:00:00 2001 From: jeang-bo-yuan Date: Wed, 26 Apr 2023 13:50:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B0=A1=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- minesweeper/CmdGame.cpp | 5 ++--- minesweeper/MineButton.cpp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/minesweeper/CmdGame.cpp b/minesweeper/CmdGame.cpp index 8fc14ce..80e8253 100644 --- a/minesweeper/CmdGame.cpp +++ b/minesweeper/CmdGame.cpp @@ -23,13 +23,12 @@ int startCmdGame() { GameBoard board; while(1) { - board.unload(); - standby(board); playing(board); int need_restart = ending(board); + if (need_restart) - continue; + board.unload(); else break; } diff --git a/minesweeper/MineButton.cpp b/minesweeper/MineButton.cpp index 13d448f..cba74b4 100644 --- a/minesweeper/MineButton.cpp +++ b/minesweeper/MineButton.cpp @@ -26,11 +26,11 @@ void MineButton::mouseReleaseEvent(QMouseEvent* event) { } void MineButton::setText(char txt) { - QPushButton::setText(QString(txt == (char)GameBoard::Mask::closed ? '\0' : txt)); + QPushButton::setText(QString(txt)); switch (txt) { case (char)GameBoard::Mask::closed: - setStyleSheet(BORDER "background-color: grey"); + setStyleSheet(BORDER "color: grey;" "background-color: grey"); break; case (char)GameBoard::Mask::flag: setStyleSheet(BORDER "background-color: blue");