Small simplification in castling rights

There is no need for a special struct with a static member
to generate castling rights.

No functional change.
This commit is contained in:
mstembera
2018-10-14 12:50:31 -07:00
committed by Marco Costalba
parent 738a6dfd4c
commit 542a2b39ed
3 changed files with 13 additions and 18 deletions

View File

@@ -250,10 +250,10 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) {
Value bonus = evaluate_shelter<Us>(pos, ksq);
// If we can castle use the bonus after the castling if it is bigger
if (pos.can_castle(MakeCastling<Us, KING_SIDE>::right))
if (pos.can_castle(Us | KING_SIDE))
bonus = std::max(bonus, evaluate_shelter<Us>(pos, relative_square(Us, SQ_G1)));
if (pos.can_castle(MakeCastling<Us, QUEEN_SIDE>::right))
if (pos.can_castle(Us | QUEEN_SIDE))
bonus = std::max(bonus, evaluate_shelter<Us>(pos, relative_square(Us, SQ_C1)));
return make_score(bonus, -16 * minKingPawnDistance);