]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Mobility is zero for a pinned piece
[stockfish] / src / movegen.cpp
index f5890a1a2fa19737c6411deae1841b3293c6fc6b..817b4f98f0763f01007e728299b23ff5ca8a5696 100644 (file)
@@ -78,7 +78,7 @@ namespace {
 
   }
 
-  // Template generate_piece_moves() with specializations
+  // Template generate_piece_moves() with specializations and overloads
   template<PieceType>
   MoveStack* generate_piece_moves(const Position&, MoveStack*, Color us, Bitboard);
 
@@ -299,7 +299,6 @@ int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned) {
 
           if (blockSquares != EmptyBoardBB)
           {
-              // Pieces moves
               mlist = generate_piece_moves<PAWN>(pos, mlist, us, blockSquares, pinned);
               mlist = generate_piece_moves<KNIGHT>(pos, mlist, us, blockSquares, pinned);
               mlist = generate_piece_moves<BISHOP>(pos, mlist, us, blockSquares, pinned);
@@ -468,8 +467,8 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
               illegal = true;
 
       if (   square_file(to) == FILE_B
-          && (   pos.piece_on(to + DELTA_W) == rook_of_color(them)
-              || pos.piece_on(to + DELTA_W) == queen_of_color(them)))
+          && (   pos.piece_on(to + DELTA_W) == piece_of_color_and_type(them, ROOK)
+              || pos.piece_on(to + DELTA_W) == piece_of_color_and_type(them, QUEEN)))
           illegal = true;
 
       return !illegal;
@@ -889,8 +888,8 @@ namespace {
 
         if (   Side == QUEEN_SIDE
             && square_file(rsq) == FILE_B
-            && (   pos.piece_on(relative_square(us, SQ_A1)) == rook_of_color(them)
-                || pos.piece_on(relative_square(us, SQ_A1)) == queen_of_color(them)))
+            && (   pos.piece_on(relative_square(us, SQ_A1)) == piece_of_color_and_type(them, ROOK)
+                || pos.piece_on(relative_square(us, SQ_A1)) == piece_of_color_and_type(them, QUEEN)))
             illegal = true;
 
         if (!illegal)