fix for prev_turn has no effect when mid-chain

This commit is contained in:
Jesse D. McDonald 2020-04-05 17:39:47 -05:00
parent cba11ec0c8
commit a7df98a990
1 changed files with 8 additions and 5 deletions

View File

@ -789,12 +789,15 @@ $(function (){
});
$('#cb_nav_prev_turn').on('click', function(){
const player = visibleGame.player;
while (visibleGame.canUndo) {
if (visibleGame.canUndo) {
visibleGame.undo();
if (visibleGame.player === player) {
visibleGame.redo();
break;
const player = visibleGame.player;
while (visibleGame.canUndo) {
visibleGame.undo();
if (visibleGame.player !== player) {
visibleGame.redo();
break;
}
}
}
renderBoard();