fixed castling rights on capture

This commit is contained in:
Karma Riuk 2025-02-03 23:40:30 +01:00
parent b1812f1df6
commit 4c86d5e815

View File

@ -231,7 +231,7 @@ Board Board::make_move(Move move) const {
}
Coords target = Coords::from_index(move.target_square);
if (move.is_capturing && c.y == 7
if (move.is_capturing && target.y == 7
&& (squares[move.target_square] & 0b111) == Rook) {
if (target.x == 0 && (ret.b_castle_rights & QueenSide))
ret.b_castle_rights &= ~(QueenSide);
@ -250,7 +250,7 @@ Board Board::make_move(Move move) const {
}
Coords target = Coords::from_index(move.target_square);
if (move.is_capturing && c.y == 7
if (move.is_capturing && target.y == 7
&& (squares[move.target_square] & 0b111) == Rook) {
if (target.x == 0 && (ret.w_castle_rights & QueenSide))
ret.w_castle_rights &= ~(QueenSide);