X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=c40b1199bd823f0f6f9268bff8ba70e42304fd21;hp=fade3cbab49d1f27a03912659099a2b3c98097ba;hb=c376ffce0f666d289a22639de29b5c409db6a9d2;hpb=549b5c478f0f455186945033559c4affe8f940ed diff --git a/src/position.cpp b/src/position.cpp index fade3cba..c40b1199 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -98,7 +98,7 @@ CheckInfo::CheckInfo(const Position& pos) { Color them = ~pos.side_to_move(); ksq = pos.king_square(them); - pinned = pos.pinned_pieces(); + pinned = pos.pinned_pieces(pos.side_to_move()); dcCandidates = pos.discovered_check_candidates(); checkSq[PAWN] = pos.attacks_from(ksq, them); @@ -422,7 +422,7 @@ const string Position::pretty(Move move) const { /// pieces, according to the call parameters. Pinned pieces protect our king, /// discovery check pieces attack the enemy king. -Bitboard Position::hidden_checkers(Square ksq, Color c) const { +Bitboard Position::hidden_checkers(Square ksq, Color c, Color toMove) const { Bitboard b, pinners, result = 0; @@ -435,7 +435,7 @@ Bitboard Position::hidden_checkers(Square ksq, Color c) const { b = between_bb(ksq, pop_lsb(&pinners)) & pieces(); if (!more_than_one(b)) - result |= b & pieces(sideToMove); + result |= b & pieces(toMove); } return result; } @@ -477,7 +477,7 @@ Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) { bool Position::legal(Move m, Bitboard pinned) const { assert(is_ok(m)); - assert(pinned == pinned_pieces()); + assert(pinned == pinned_pieces(sideToMove)); Color us = sideToMove; Square from = from_sq(m); @@ -515,7 +515,7 @@ bool Position::legal(Move m, Bitboard pinned) const { // is moving along the ray towards or away from the king. return !pinned || !(pinned & from) - || squares_aligned(from, to_sq(m), king_square(us)); + || aligned(from, to_sq(m), king_square(us)); } @@ -658,7 +658,7 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { { // For pawn and king moves we need to verify also direction if ( (pt != PAWN && pt != KING) - || !squares_aligned(from, to, king_square(~sideToMove))) + || !aligned(from, to, king_square(~sideToMove))) return true; }