fix for prev_turn has no effect when mid-chain
This commit is contained in:
parent
cba11ec0c8
commit
a7df98a990
|
|
@ -789,14 +789,17 @@ $(function (){
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cb_nav_prev_turn').on('click', function(){
|
$('#cb_nav_prev_turn').on('click', function(){
|
||||||
|
if (visibleGame.canUndo) {
|
||||||
|
visibleGame.undo();
|
||||||
const player = visibleGame.player;
|
const player = visibleGame.player;
|
||||||
while (visibleGame.canUndo) {
|
while (visibleGame.canUndo) {
|
||||||
visibleGame.undo();
|
visibleGame.undo();
|
||||||
if (visibleGame.player === player) {
|
if (visibleGame.player !== player) {
|
||||||
visibleGame.redo();
|
visibleGame.redo();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
renderBoard();
|
renderBoard();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue