From c3d16e78d99e27ddd294647f8f97751727069d5a Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 3 Mar 2020 23:31:55 +0100 Subject: [PATCH] Fix clocks in corr games --- client/src/variants/Dark.js | 5 +++++ client/src/views/Game.vue | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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 -- 2.44.0