From: Benjamin Auder Date: Wed, 10 Feb 2021 12:30:22 +0000 (+0100) Subject: Patch Dynamo to work with old stored games too X-Git-Url: https://git.auder.net/variants/Chakart/pieces/current/doc/current/git-logo.png?a=commitdiff_plain;h=a1e392e6a5a3d32203e3b93a21332a460f4671d5;p=vchess.git Patch Dynamo to work with old stored games too --- 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) {