From a1e392e6a5a3d32203e3b93a21332a460f4671d5 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 10 Feb 2021 13:30:22 +0100
Subject: [PATCH] Patch Dynamo to work with old stored games too

---
 client/src/variants/Dynamo.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/client/src/variants/Dynamo.js b/client/src/variants/Dynamo.js
index b3559c78..528f8c1b 100644
--- a/client/src/variants/Dynamo.js
+++ b/client/src/variants/Dynamo.js
@@ -771,6 +771,11 @@ export class DynamoRules extends ChessRules {
   }
 
   play(move) {
+    if (this.subTurn == 1 && move.vanish.length == 0) {
+      // Patch to work with old format: (TODO: remove later)
+      move.ignore = true;
+      return;
+    }
     const color = this.turn;
     move.subTurn = this.subTurn; //for undo
     const gotoNext = (mv) => {
@@ -829,6 +834,7 @@ export class DynamoRules extends ChessRules {
   }
 
   undo(move) {
+    if (!!move.ignore) return; //TODO: remove that later
     this.disaggregateFlags(JSON.parse(move.flags));
     V.UndoOnBoard(this.board, move);
     if (this.subTurn == 1) {
-- 
2.44.0