From: Benjamin Auder Date: Fri, 8 Jan 2021 17:53:18 +0000 (+0100) Subject: Fix Synchrone2. Disable analysis mode: now playable X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/doc/html/app_dev.php?a=commitdiff_plain;h=715f705c877510885be243c84f62722f6136abbe;p=vchess.git Fix Synchrone2. Disable analysis mode: now playable --- diff --git a/client/src/variants/Synchrone2.js b/client/src/variants/Synchrone2.js index 00d68ad7..ee016844 100644 --- a/client/src/variants/Synchrone2.js +++ b/client/src/variants/Synchrone2.js @@ -5,7 +5,7 @@ import { randInt } from "@/utils/alea"; export class Synchrone2Rules extends Synchrone1Rules { static get CanAnalyze() { - return true;//false; + return false; } static get HasEnpassant() { @@ -199,7 +199,17 @@ export class Synchrone2Rules extends Synchrone1Rules { this.turn = V.GetOppCol(this.turn); this.movesCount--; if (this.movesCount % 4 == 0) this.initfenStack.pop(); - if (move.vanish.length > 0) super.postUndo(move); + this.postUndo(move); + } + + postUndo(move) { + if (this.turn == 'w') { + // Reset king positions: scan board (TODO: could be more efficient) + if (move.vanish.length > 0) this.scanKings(); + // Also reset whiteMove + this.whiteMove = null; + } + else this.whiteMove = move.whiteMove; } getCurrentScore() {