From: Benjamin Auder Date: Tue, 3 Mar 2020 22:31:55 +0000 (+0100) Subject: Fix clocks in corr games X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/doc/html/packages.html?a=commitdiff_plain;h=c3d16e78d99e27ddd294647f8f97751727069d5a;p=vchess.git Fix clocks in corr games --- diff --git a/client/src/variants/Dark.js b/client/src/variants/Dark.js index 81f87008..96163bfb 100644 --- a/client/src/variants/Dark.js +++ b/client/src/variants/Dark.js @@ -78,6 +78,11 @@ export const VariantRules = class DarkRules extends ChessRules { } } + filterValid(moves) { + // Used in the interface + return moves; + } + // Has to be redefined to avoid an infinite loop getAllValidMoves() { const color = this.turn; diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 6c289e61..5471a3fe 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -517,8 +517,10 @@ export default { if (L >= 1) { const gameLastupdate = game.moves[L-1].played; game.initime[L % 2] = gameLastupdate; - if (L >= 2) - game.clocks[L % 2] = Date.now() - gameLastupdate; + if (L >= 2) { + game.clocks[L % 2] = + tc.mainTime - (Date.now() - gameLastupdate) / 1000; + } } } // Sort chat messages from newest to oldest