When switching king position, don't redo moves player had undone
This commit is contained in:
parent
54e4621548
commit
f8d47a3b73
|
@ -713,6 +713,7 @@
|
|||
let blackQueen = blackKing === 'd8' ? 'e8' : 'd8';
|
||||
|
||||
// Undo all moves
|
||||
let historylength = moveHistory.length;
|
||||
while (moveHistory.length > 0) {
|
||||
undoMove();
|
||||
}
|
||||
|
@ -723,8 +724,8 @@
|
|||
document.getElementById(blackKing).firstChild.data = '♚';
|
||||
document.getElementById(blackQueen).firstChild.data = '♛';
|
||||
|
||||
// Redo all the moves we can
|
||||
while (moveFuture.length > 0) {
|
||||
// Redo until we can or until the point where we were before, whichever is first
|
||||
while (moveHistory.length < historylength) {
|
||||
if (!redoMove()) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue