点击新建游戏按钮时如果双方总共已经下12步以上则算负
原来是进入走棋阶段就算负,现在调整为摆棋阶段12步以上就算负
This commit is contained in:
parent
d5588e0ed3
commit
a7fad6a693
|
@ -160,12 +160,6 @@ void GameController::gameReset()
|
|||
// 定时器ID为0
|
||||
timeID = 0;
|
||||
|
||||
// 棋未下完,则算对手得分
|
||||
if (game.getPhase() == PHASE_MOVING &&
|
||||
game.whoWin() == PLAYER_NOBODY) {
|
||||
giveUp();
|
||||
}
|
||||
|
||||
// 重置游戏
|
||||
game.reset();
|
||||
tempGame = game;
|
||||
|
@ -1172,6 +1166,13 @@ void GameController::showTestWindow()
|
|||
gameTest->show();
|
||||
}
|
||||
|
||||
void GameController::humanGiveUp()
|
||||
{
|
||||
if (game.whoWin() == PLAYER_NOBODY) {
|
||||
giveUp();
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::saveScore()
|
||||
{
|
||||
qint64 pid = QCoreApplication::applicationPid();
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
void setAiDepthTime(depth_t depth1, int time1, depth_t depth2, int time2);
|
||||
void getAiDepthTime(depth_t &depth1, int &time1, depth_t &depth2, int &time2);
|
||||
|
||||
void humanGiveUp();
|
||||
|
||||
signals:
|
||||
|
||||
// 玩家1(先手)赢盘数改变的信号
|
||||
|
|
|
@ -579,6 +579,8 @@ void MillGameWindow::actionRules_triggered()
|
|||
|
||||
void MillGameWindow::on_actionNew_N_triggered()
|
||||
{
|
||||
auto *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
|
||||
|
||||
#ifdef SAVE_GAMEBOOK_WHEN_ACTION_NEW_TRIGGERED
|
||||
QString strDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd_hhmmss");
|
||||
|
||||
|
@ -588,13 +590,16 @@ void MillGameWindow::on_actionNew_N_triggered()
|
|||
+ ".txt";
|
||||
|
||||
// 下了一定步数之后新建游戏时才保存棋谱
|
||||
auto *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
|
||||
|
||||
if (strlist->stringList().size() > 18) {
|
||||
saveBook(path);
|
||||
}
|
||||
#endif /* SAVE_GAMEBOOK_WHEN_ACTION_NEW_TRIGGERED */
|
||||
|
||||
// 棋未下完,且已经走了若干步以上,则算对手得分
|
||||
if (strlist->stringList().size() > 12) {
|
||||
gameController->humanGiveUp();
|
||||
}
|
||||
|
||||
gameController->saveScore();
|
||||
|
||||
// 取消自动运行
|
||||
|
|
Loading…
Reference in New Issue