棋未下完就新建游戏,算玩家2得分
This commit is contained in:
parent
1d122bd4cd
commit
8dc56dfa21
|
@ -105,6 +105,23 @@ void GameController::gameReset()
|
|||
// 定时器ID为0
|
||||
timeID = 0;
|
||||
|
||||
// 棋未下完,则算对手得分
|
||||
if (score1 < 0 || score2 < 0) {
|
||||
score1++;
|
||||
score2++;
|
||||
}
|
||||
else {
|
||||
if (chess_.getStage() == NineChess::GAME_MOVING &&
|
||||
chess_.whoWin() == NineChess::NOBODY)
|
||||
{
|
||||
// TODO: 修改成电脑得分
|
||||
score2++;
|
||||
}
|
||||
}
|
||||
|
||||
emit time1Changed(QString::number(score1, 10));
|
||||
emit time2Changed(QString::number(score2, 10));
|
||||
|
||||
// 重置游戏
|
||||
chess_.reset();
|
||||
chessTemp = chess_;
|
||||
|
@ -115,20 +132,6 @@ void GameController::gameReset()
|
|||
isEngine1 = false;
|
||||
isEngine2 = false;
|
||||
|
||||
// 询问是否认输
|
||||
if (score1 < 0 || score2 < 0) {
|
||||
score1++;
|
||||
score2++;
|
||||
} else {
|
||||
QMessageBox giveupMessageBox(QMessageBox::Warning, "Information", "认输吗?", QMessageBox::Yes | QMessageBox::No, NULL);
|
||||
if (giveupMessageBox.exec() == QMessageBox::Yes) {
|
||||
score2++;
|
||||
}
|
||||
}
|
||||
|
||||
emit time1Changed(QString::number(score1, 10));
|
||||
emit time2Changed(QString::number(score2, 10));
|
||||
|
||||
// 清除棋子
|
||||
qDeleteAll(pieceList);
|
||||
pieceList.clear();
|
||||
|
|
Loading…
Reference in New Issue