From c46ab4fbb92ca361361c1975fd57b2d295535c20 Mon Sep 17 00:00:00 2001 From: Josh Perry Date: Thu, 20 May 2021 07:32:19 +0100 Subject: [PATCH] LibChess: Fixed PGN export bug (#7300) In cases with ambiguous captures involving pawns (where multiple pieces could have made the capture), we were exporting invalid syntax for the move: `1. e4 e5 2. Bb5 c6 3. Bxc6 ddxc6` Move 3 should be `Bxc6 dxc6`, but we were duplicating the d on the pawn move. --- Userland/Libraries/LibChess/Chess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index 5b21d2dc29..981db18715 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -199,7 +199,7 @@ String Move::to_algebraic() const } if (is_capture) { - if (piece.type == Type::Pawn) + if (piece.type == Type::Pawn && !is_ambiguous) builder.append(from.to_algebraic().substring(0, 1)); builder.append("x"); }