From 715f705c877510885be243c84f62722f6136abbe Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 8 Jan 2021 18:53:18 +0100
Subject: [PATCH] Fix Synchrone2. Disable analysis mode: now playable

---
 client/src/variants/Synchrone2.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

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() {
-- 
2.44.0