X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=923e9400ac73f6f8656918bf48e53d59b0ee7529;hp=67af3b9ff306d7ec4af666738b537035a97a2d7e;hb=411d23cd80a2dbf53d21008976d34e7f450154bf;hpb=3d55deea9a2011c38d8d0067bd57fc889958bec2 diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 67af3b9f..923e9400 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -61,7 +61,7 @@ export default { rid: "" }, game: { }, //passed to BaseGame - oppConnected: false, + oppConnected: false, //TODO: use for styling corrMsg: "", //to send offline messages in corr games virtualClocks: [0, 0], //initialized with true game.clocks vr: null, //"variant rules" object initialized from FEN @@ -152,18 +152,21 @@ export default { case "pong": //received if we sent a ping (game still alive on our side) { this.oppConnected = true; - // Send our "last state" informations to opponent(s) - const L = this.game.moves.length; - this.st.conn.send(JSON.stringify({ - code: "lastate", - target: this.game.oppid, - gameId: this.gameRef.id, - lastMove: (L>0 ? this.game.moves[L-1] : undefined), - score: this.game.score, - movesCount: L, - drawOffer: this.drawOffer, - clocks: this.game.clocks, - })); + if (this.game.type == "live") //corr games are always complete + { + // Send our "last state" informations to opponent(s) + const L = this.game.moves.length; + this.st.conn.send(JSON.stringify({ + code: "lastate", + target: this.game.oppid, + gameId: this.gameRef.id, + lastMove: (L>0 ? this.game.moves[L-1] : undefined), + score: this.game.score, + movesCount: L, + drawOffer: this.drawOffer, + clocks: this.game.clocks, + })); + } break; } case "lastate": //got opponent infos about last move