X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=cb5370d5b581412af7b800a6ffc891abcca75739;hb=fbdabe2975c0e86a04b01c36c9f3eec5494ecf0d;hp=281109b19a34a8ba6d3f6602115d7b61d4cbb43a;hpb=0cfb30e5be9e66766b3b8e5870b5737b48b1b632;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 281109b1..cb5370d5 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -513,14 +513,14 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { assert(piece_color(piece_on(from)) == us); assert(piece_on(king_square(us)) == make_piece(us, KING)); - // En passant captures are a tricky special case. Because they are - // rather uncommon, we do it simply by testing whether the king is attacked - // after the move is made + // En passant captures are a tricky special case. Because they are rather + // uncommon, we do it simply by testing whether the king is attacked after + // the move is made. if (move_is_ep(m)) { Color them = opposite_color(us); Square to = move_to(m); - Square capsq = make_square(square_file(to), square_rank(from)); + Square capsq = to + Square(us == WHITE ? -8 : 8); Square ksq = king_square(us); Bitboard b = occupied_squares();