From 42d9f8eb5909a3f813f939114d95e8fa91030f71 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 17 Feb 2021 22:45:47 +0100 Subject: [PATCH] Better Schess notation when introducing pieces while castling --- client/src/variants/Schess.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/variants/Schess.js b/client/src/variants/Schess.js index bdc93275..d8e1b1c5 100644 --- a/client/src/variants/Schess.js +++ b/client/src/variants/Schess.js @@ -342,7 +342,14 @@ export class SchessRules extends ChessRules { const nothingAppear = (move.appear[0].p == V.NOTHING); if (pPieceAppear || nothingAppear) { let suffix = ""; - if (pPieceAppear) suffix = "/" + move.appear[0].p.toUpperCase(); + if (pPieceAppear) { + suffix = "/" + move.appear[0].p.toUpperCase(); + if (move.appear.length == 3) { + // Castling; indicate square + suffix += + V.CoordsToSquare({ x: move.appear[0].x, y: move.appear[0].y }); + } + } let cmove = JSON.parse(JSON.stringify(move)); cmove.appear.shift(); return super.getNotation(cmove) + suffix; -- 2.44.0