qt: 解决悔棋时棋谱未回退着法就在后面附加新着法的错误

This commit is contained in:
Calcitem 2020-11-08 09:21:06 +08:00
parent 2c3e950716
commit fe8be55163
1 changed files with 7 additions and 1 deletions

View File

@ -812,7 +812,13 @@ bool GameController::actionPiece(QPointF pos)
if (QMessageBox::Ok == msgBox.exec()) {
#endif /* !MOBILE_APP_UI */
manualListModel.removeRows(currentRow + 1, manualListModel.rowCount() - currentRow - 1);
int rowCount = manualListModel.rowCount();
int removeCount = rowCount - currentRow - 1;
manualListModel.removeRows(currentRow + 1, rowCount - currentRow - 1);
for (int i = 0; i < removeCount; i++) {
cmdlist.pop_back();
}
// 如果再决出胜负后悔棋,则重新启动计时
if (position.get_winner() == NOBODY) {