X-Git-Url: https://git.auder.net/images/pieces/%22%20%20V.getPpath%28board%5Bi%5D%5Bj%5D%29%20%20%20%22.svg?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBaseGame.vue;h=85007395acb1dc185527aba19e2242830e98fb92;hb=eac8fbb5f23107cf82ad28c64efa00d556c4691e;hp=5fbc257b85ca2f779a9f591e582536167dc48c41;hpb=8055eabd23feaabe878b25522929c7273dcb0f24;p=vchess.git diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 5fbc257b..85007395 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -355,18 +355,22 @@ export default { })(); }; const afterMove = (smove, initurn) => { - if (this.st.settings.sound == 2) - new Audio("/sounds/move.mp3").play().catch(() => {}); if (this.vr.turn != initurn) { // Turn has changed: move is complete + if (!smove.fen) { + // NOTE: only FEN of last sub-move is required (thus setting it here) + smove.fen = this.vr.getFen(); + this.emitFenIfAnalyze(); + } this.inMultimove = false; const score = this.vr.getCurrentScore(); if (score != "*") { const message = getScoreMessage(score); if (!navigate && this.game.mode != "analyze") this.$emit("gameover", score, message); - // Just show score on screen (allow undo) - else this.showEndgameMsg(score + " . " + this.st.tr[message]); + else if (this.game.mode == "analyze") + // Just show score on screen (allow undo) + this.showEndgameMsg(score + " . " + this.st.tr[message]); } if (!navigate && this.game.mode != "analyze") { const L = this.moves.length; @@ -405,11 +409,8 @@ export default { if (received && this.cursor < this.moves.length - 1) this.gotoEnd(); playMove(); - this.lastMove.fen = this.vr.getFen(); - this.emitFenIfAnalyze(); }, cancelCurrentMultimove: function() { - // Cancel current multi-move const L = this.moves.length; let move = this.moves[L-1]; if (!Array.isArray(move)) move = [move]; @@ -438,8 +439,6 @@ export default { if (light) this.cursor--; else { this.positionCursorTo(this.cursor - 1); - if (this.st.settings.sound == 2) - new Audio("/sounds/undo.mp3").play().catch(() => {}); this.incheck = this.vr.getCheckSquares(this.vr.turn); this.emitFenIfAnalyze(); }