X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fpawns.cpp;h=98e13f8373af1b8d6d9827d1f4ea667027d40a8d;hb=8a9c298deeee372251d95c867f877a7ac3a7c3fb;hp=75b94c19c0d012e1a00e7e3abc98d644afb4072b;hpb=767c4ad1fc487b72240006c888aaf8c00006cd82;p=stockfish diff --git a/src/pawns.cpp b/src/pawns.cpp index 75b94c19..98e13f83 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -237,8 +237,9 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) { /// when king square changes, which is about 20% of total king_safety() calls. template -Score Entry::do_king_safety(const Position& pos, Square ksq) { +Score Entry::do_king_safety(const Position& pos) { + Square ksq = pos.square(Us); kingSquares[Us] = ksq; castlingRights[Us] = pos.can_castle(Us); int minKingPawnDistance = 0; @@ -250,17 +251,17 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) { Value bonus = evaluate_shelter(pos, ksq); // If we can castle use the bonus after the castling if it is bigger - if (pos.can_castle(MakeCastling::right)) + if (pos.can_castle(Us | KING_SIDE)) bonus = std::max(bonus, evaluate_shelter(pos, relative_square(Us, SQ_G1))); - if (pos.can_castle(MakeCastling::right)) + if (pos.can_castle(Us | QUEEN_SIDE)) bonus = std::max(bonus, evaluate_shelter(pos, relative_square(Us, SQ_C1))); return make_score(bonus, -16 * minKingPawnDistance); } // Explicit template instantiation -template Score Entry::do_king_safety(const Position& pos, Square ksq); -template Score Entry::do_king_safety(const Position& pos, Square ksq); +template Score Entry::do_king_safety(const Position& pos); +template Score Entry::do_king_safety(const Position& pos); } // namespace Pawns