X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=8389bde185a0c2617f93900deba5e26c853b751c;hp=7aa7aa5f4c0d46d45376717d921faf2278593ca1;hb=8a7452b520dc7ead6880a7e62e7c0e057db1ebda;hpb=6ec161b904b068b0f07defce45dba936933f4a1b diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 7aa7aa5f..8389bde1 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -250,8 +250,9 @@ export default { // Post-processing: decorate each move with current FEN: // (to be able to jump to any position quickly) game.moves.forEach(move => { + // TODO: this is doing manually what BaseGame.play() achieve... move.color = this.vr.turn; - vr.play(move); + this.vr.play(move); move.fen = this.vr.getFen(); }); this.vr.re_init(game.fen); @@ -281,7 +282,7 @@ export default { const filtered_move = Object.keys(move) .filter(key => allowed_fields.includes(key)) .reduce((obj, key) => { - obj[key] = raw[key]; + obj[key] = move[key]; return obj; }, {}); // Send move ("newmove" event) to opponent(s) (if ours) @@ -291,11 +292,11 @@ export default { const elapsed = Date.now() - GameStorage.getInitime(); this.game.players.forEach(p => { if (p.sid != this.st.user.sid) - this.st.conn.send("newmove", - { + this.st.conn.send(JSON.stringify({ + code: "newmove", target: p.sid, move: Object.assign({}, filtered_move, {elapsed: elapsed}), - }); + })); }); move.elapsed = elapsed; }