Browse Source

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.
Josh Perry 4 years ago
parent
commit
c46ab4fbb9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Userland/Libraries/LibChess/Chess.cpp

+ 1 - 1
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");
     }