X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=89911e50b69bd848d59bf9ae01c2549112f72f60;hp=f767f6dbcbf442af1b4455ff01571f093a8bc8cf;hb=5f12069cbfc882fdf989d04618ad9c33e603c419;hpb=402a7ae151cfc6090c8f6682763b0fb3729bf8ca diff --git a/src/pawns.cpp b/src/pawns.cpp index f767f6db..89911e50 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -257,7 +257,7 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) { b = theirPawns & file_bb(f); rkThem = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; - if ( (MiddleEdges & (f | rkThem)) + if ( (MiddleEdges & make_square(f, rkThem)) && file_of(ksq) == f && relative_rank(Us, ksq) == rkThem - 1) safety += Value(200); @@ -278,7 +278,7 @@ template Score Entry::update_safety(const Position& pos, Square ksq) { kingSquares[Us] = ksq; - castlingFlags[Us] = pos.can_castle(Us); + castlingRights[Us] = pos.can_castle(Us); minKPdistance[Us] = 0; Bitboard pawns = pos.pieces(Us, PAWN); @@ -291,10 +291,10 @@ Score Entry::update_safety(const Position& pos, Square ksq) { Value bonus = shelter_storm(pos, ksq); // If we can castle use the bonus after the castling if it is bigger - if (pos.can_castle(make_castling_flag(Us, KING_SIDE))) + if (pos.can_castle(MakeCastling::right)) bonus = std::max(bonus, shelter_storm(pos, relative_square(Us, SQ_G1))); - if (pos.can_castle(make_castling_flag(Us, QUEEN_SIDE))) + if (pos.can_castle(MakeCastling::right)) bonus = std::max(bonus, shelter_storm(pos, relative_square(Us, SQ_C1))); return kingSafety[Us] = make_score(bonus, -16 * minKPdistance[Us]);