Fix double-move sending in corr games
authorBenjamin Auder <benjamin.auder@somewhere>
Fri, 3 Apr 2020 22:16:47 +0000 (00:16 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Fri, 3 Apr 2020 22:16:47 +0000 (00:16 +0200)
client/src/views/Game.vue

index 8b5ca8b..398a0a2 100644 (file)
@@ -1451,9 +1451,12 @@ export default {
           }
         );
         // PlayOnBoard is enough, and more appropriate for Synchrone Chess
           }
         );
         // PlayOnBoard is enough, and more appropriate for Synchrone Chess
-        V.PlayOnBoard(this.vr.board, move);
+        const arMove = (Array.isArray(move) ? move : [move]);
+        for (let i = 0; i < arMove.length; i++)
+          V.PlayOnBoard(this.vr.board, arMove[i]);
         const position = this.vr.getBaseFen();
         const position = this.vr.getBaseFen();
-        V.UndoOnBoard(this.vr.board, move);
+        for (let i = arMove.length - 1; i >= 0; i--)
+          V.UndoOnBoard(this.vr.board, arMove[i]);
         if (["all","byrow"].includes(V.ShowMoves)) {
           this.curDiag = getDiagram({
             position: position,
         if (["all","byrow"].includes(V.ShowMoves)) {
           this.curDiag = getDiagram({
             position: position,