ExtMove* generate_castling(const Position& pos, ExtMove* moveList) {
constexpr CastlingRight Cr = Us | Cs;
- constexpr bool KingSide = (Cr == WHITE_OO || Cr == BLACK_OO);
+ constexpr bool KingSide = (Cs == KING_SIDE);
if (pos.castling_impeded(Cr) || !pos.can_castle(Cr))
return moveList;
// Compute our parametrized parameters at compile time, named according to
// the point of view of white side.
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
- constexpr Bitboard TRank8BB = (Us == WHITE ? Rank8BB : Rank1BB);
constexpr Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
}
// Promotions and underpromotions
- if (pawnsOn7 && (Type != EVASIONS || (target & TRank8BB)))
+ if (pawnsOn7)
{
if (Type == CAPTURES)
emptySquares = ~pos.pieces();
*moveList++ = make_move(ksq, pop_lsb(&b));
}
- if (Type != CAPTURES && Type != EVASIONS && pos.can_castle(Us))
+ if (Type != CAPTURES && Type != EVASIONS && pos.castling_rights(Us))
{
if (pos.is_chess960())
{