X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=65d46460758f23aabd7014b243b95cdd88a7ec11;hb=b2e8c34e0158f512741d67b8a1c25425e0b8747e;hp=c2b27043e634103b39d107bd3465538fdb69ba35;hpb=af4a532a1e1b25f85b240afc4edb244d9dd3ef5f;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index c2b27043..65d46460 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -1056,8 +1056,7 @@ export default { cadence: this.game.cadence }; const notifyNewGame = () => { - const oppsid = this.getOppsid(); //may be null - this.send("rnewgame", { data: gameInfo, oppsid: oppsid }); + this.send("rnewgame", { data: gameInfo }); // To main Hall if corr game: if (this.game.type == "corr") this.send("newgame", { data: gameInfo, page: "/" }); @@ -1065,6 +1064,10 @@ export default { this.notifyMyGames("newgame", gameInfo); }; if (this.game.type == "live") { + GameStorage.update( + this.gameRef, + { rematchOffer: "" } + ); // Increment game stats counter in DB ajax( "/gamestat", @@ -1075,15 +1078,16 @@ export default { } else { // corr game + this.updateCorrGame({ rematchOffer: 'n' }); ajax( "/games", "POST", { data: { gameInfo: gameInfo }, success: (response) => { - gameInfo.id = response.gameId; + gameInfo.id = response.id; notifyNewGame(); - this.$router.push("/game/" + response.gameId); + this.$router.push("/game/" + response.id); } } ); @@ -1402,18 +1406,20 @@ export default { // In corr games, just reset clock to mainTime: this.game.clocks[colorIdx] = extractTime(this.game.cadence).mainTime; } - // If repetition detected, consider that a draw offer was received: - const fenObj = this.vr.getFenForRepeat(); - this.repeat[fenObj] = - !!this.repeat[fenObj] - ? this.repeat[fenObj] + 1 - : 1; - if (this.repeat[fenObj] >= 3) { - if (V.LoseOnRepetition) - this.gameOver(moveCol == "w" ? "0-1" : "1-0", "Repetition"); - else this.drawOffer = "threerep"; + if (!V.IgnoreRepetition) { + // If repetition detected, consider that a draw offer was received: + const fenObj = this.vr.getFenForRepeat(); + this.repeat[fenObj] = + !!this.repeat[fenObj] + ? this.repeat[fenObj] + 1 + : 1; + if (this.repeat[fenObj] >= 3) { + if (V.LoseOnRepetition) + this.gameOver(moveCol == "w" ? "0-1" : "1-0", "Repetition"); + else this.drawOffer = "threerep"; + } + else if (this.drawOffer == "threerep") this.drawOffer = ""; } - else if (this.drawOffer == "threerep") this.drawOffer = ""; if (!!this.game.mycolor && !data.receiveMyMove) { // NOTE: 'var' to see that variable outside this block var filtered_move = getFilteredMove(move);