Bitboard passedPawns[2];
Bitboard pawnAttacks[2];
Square kingSquares[2];
+ int minKPdistance[2];
+ int castleRights[2];
Score value;
int halfOpenFiles[2];
Score kingSafety[2];
template<Color Us>
inline Score PawnEntry::king_safety(const Position& pos, Square ksq) {
- return kingSquares[Us] == ksq ? kingSafety[Us] : update_safety<Us>(pos, ksq);
+ return kingSquares[Us] == ksq && castleRights[Us] == pos.can_castle(Us)
+ ? kingSafety[Us] : update_safety<Us>(pos, ksq);
}
#endif // !defined(PAWNS_H_INCLUDED)