remove_piece: 将更新棋盘上棋子数以及检查游戏结束条件的语句提前
提前到判断 false 条件之后马上进行,更新 hash 值之前。
This commit is contained in:
parent
e0ed37a13e
commit
962cece2c5
|
@ -762,6 +762,12 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
|
|||
return false;
|
||||
}
|
||||
|
||||
pieceCountOnBoard[them]--;
|
||||
|
||||
if (check_gameover_condition()) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
revert_key(s);
|
||||
|
||||
if (rule.hasBannedLocations && phase == PHASE_PLACING) {
|
||||
|
@ -784,14 +790,9 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
|
|||
currentSquare = SQ_0;
|
||||
|
||||
pieceCountNeedRemove--;
|
||||
pieceCountOnBoard[them]--;
|
||||
|
||||
// Remove piece completed
|
||||
|
||||
if (check_gameover_condition()) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pieceCountNeedRemove > 0) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue