Introduce make_castle_right() helper

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-04-08 17:07:56 +01:00
parent e56342ed00
commit d549497144
4 changed files with 12 additions and 12 deletions

View File

@@ -35,16 +35,14 @@ namespace {
template<CastlingSide Side, bool OnlyChecks>
MoveStack* generate_castle(const Position& pos, MoveStack* mlist, Color us) {
CastleRight cr = CastleRight((Side == KING_SIDE ? WHITE_OO : WHITE_OOO) << us);
if (pos.castle_impeded(us, Side) || !pos.can_castle(cr))
if (pos.castle_impeded(us, Side) || !pos.can_castle(make_castle_right(us, Side)))
return mlist;
// After castling, the rook and king final positions are the same in Chess960
// as they would be in standard chess.
Square kfrom = pos.king_square(us);
Square kto = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
Square rfrom = pos.castle_rook_square(us, Side);
Square kto = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
Bitboard enemies = pos.pieces(~us);
assert(!pos.in_check());