X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=91e6b6affd0a2eaf9076622aaed0657c7ac75b76;hb=e8da204a3064d6cc3d655e94413e7cdb85e381c7;hp=9bca38ee472e380ec08e751c0f2fb25c42c3b0ca;hpb=57eb158fe8e37daaae11685df846003cda4aba19;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 9bca38ee..91e6b6af 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -246,7 +246,7 @@ export default { notifyTurn: function(sid) { const player = this.people[sid]; const colorIdx = this.game.players.findIndex( - p => p.sid == sid || p.id == player.id); + p => p.sid == sid || p.uid == player.id); const color = ["w","b"][colorIdx]; const movesCount = this.game.moves.length; const yourTurn = @@ -387,7 +387,20 @@ export default { } break; case "askfullgame": - this.send("fullgame", { data: this.game, target: data.from }); + const gameToSend = Object.keys(this.game) + .filter(k => + [ + "id","fen","players","vid","cadence","fenStart","vname", + "moves","clocks","initime","score","drawOffer" + ].includes(k)) + .reduce( + (obj, k) => { + obj[k] = this.game[k]; + return obj; + }, + {} + ); + this.send("fullgame", { data: gameToSend, target: data.from }); break; case "fullgame": // Callback "roomInit" to poll clients only after game is loaded @@ -540,7 +553,7 @@ export default { this.gameOver("1/2", message); } else if (this.drawOffer == "") { // No effect if drawOffer == "sent" - if (!!this.game.mycolor != this.vr.turn) { + if (this.game.mycolor != this.vr.turn) { alert(this.st.tr["Draw offer only in your turn"]); return; } @@ -641,7 +654,7 @@ export default { } } } - if (game.drawOffer) { + if (!!game.drawOffer) { if (game.drawOffer == "t") // Three repetitions this.drawOffer = "threerep";