X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=app.js;h=12c2b7ab65fea59a497ed1901a924889b0225491;hp=1090b30ce6c6f2545e775c156c76892387301b75;hb=eceb02f712e49d6c8b2fa90691c93161ca015248;hpb=4fd396b4d42189eae78583f332d845db9111a0fb diff --git a/app.js b/app.js index 1090b30..12c2b7a 100644 --- a/app.js +++ b/app.js @@ -373,7 +373,7 @@ const messageCenter = (msg) => { if (document.hidden) notifyMe("move"); vr.playReceivedMove(obj.moves, () => { - if (vr.getCurrentScore(obj.moves[obj.moves.length-1]) != "*") { + if (vr.getCurrentScore(obj.moves) != "*") { localStorage.removeItem("gid"); setTimeout( () => toggleVisible("gameStopped"), 2000 ); } @@ -470,7 +470,6 @@ const afterPlay = (move_s, newTurn, ops) => { {gid: gid, moves: curMoves, fen: vr.getFen()}, { retry: true, - success: () => curMoves = [], error: () => alert("Move not sent: reload page") } ); @@ -478,7 +477,8 @@ const afterPlay = (move_s, newTurn, ops) => { } if (ops.res && newTurn != playerColor) { toggleTurnIndicator(false); //now all moves are sent and animated - const result = vr.getCurrentScore(move_s); + const result = vr.getCurrentScore(curMoves); + curMoves = []; if (result != "*") { setTimeout(() => { toggleVisible("gameStopped");