X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=ca7c460047bdd16716584916bbe4bd3abfcfe804;hp=52e6dd0fc5b520d1696b2987ff907e512b009526;hb=034a2b04f2fc1017721b4f3fc12895e5f8a190bd;hpb=42caebfaa5854c28cc2799536bfc56a9b7ba97f3 diff --git a/src/position.cpp b/src/position.cpp index 52e6dd0f..ca7c4600 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -455,23 +455,6 @@ Bitboard Position::attackers_to(Square s, Bitboard occ) const { } -/// Position::attacks_from() computes a bitboard of all attacks of a given piece -/// put in a given square. Slider attacks use occ bitboard as occupancy. - -Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) { - - assert(is_ok(s)); - - switch (type_of(p)) - { - case BISHOP: return attacks_bb(s, occ); - case ROOK : return attacks_bb(s, occ); - case QUEEN : return attacks_bb(s, occ) | attacks_bb(s, occ); - default : return StepAttacksBB[p][s]; - } -} - - /// Position::legal() tests whether a pseudo-legal move is legal bool Position::legal(Move m, Bitboard pinned) const { @@ -515,7 +498,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 +641,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; } @@ -672,7 +655,7 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { switch (type_of(m)) { case PROMOTION: - return attacks_from(Piece(promotion_type(m)), to, pieces() ^ from) & ksq; + return attacks_bb(Piece(promotion_type(m)), to, pieces() ^ from) & ksq; // En passant capture with check ? We have already handled the case // of direct checks and ordinary discovered check, the only case we