X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=3c0be19d2aa0c75d9974b6a86dfe61491d94c0df;hb=95212222c7444538b84326208e433ac12f15e9fb;hp=fe964935c828282490b53a3927cc18c471f263d1;hpb=f200f3ccd2281deadecb6279fac59b16dea622d5;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index fe964935..3c0be19d 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -569,13 +569,12 @@ namespace { // problem, especially when that pawn is also blocked. if (s == relative_square(Us, SQ_A1) || s == relative_square(Us, SQ_H1)) { - SquareDelta d = pawn_push(Us) - + (square_file(s) == FILE_A ? DELTA_E : DELTA_W); - if (pos.piece_on(s + d) == piece_of_color_and_type(Us, PAWN)) + Square d = pawn_push(Us) + (square_file(s) == FILE_A ? DELTA_E : DELTA_W); + if (pos.piece_on(s + d) == make_piece(Us, PAWN)) { if (!pos.square_is_empty(s + d + pawn_push(Us))) bonus -= 2*TrappedBishopA1H1Penalty; - else if (pos.piece_on(s + 2*d) == piece_of_color_and_type(Us, PAWN)) + else if (pos.piece_on(s + 2*d) == make_piece(Us, PAWN)) bonus -= TrappedBishopA1H1Penalty; else bonus -= TrappedBishopA1H1Penalty / 2; @@ -840,8 +839,8 @@ namespace { // If there is an enemy rook or queen attacking the pawn from behind, // add all X-ray attacks by the rook or queen. Otherwise consider only // the squares in the pawn's path attacked or occupied by the enemy. - if ( (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them)) - && (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from(s))) + if ( (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them)) + && (squares_in_front_of(Them, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from(s))) unsafeSquares = squaresToQueen; else unsafeSquares = squaresToQueen & (ei.attackedBy[Them][0] | pos.pieces_of_color(Them));