From f56178ec9afdd89b85fc0284bddefa5b3f9515d1 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 1 Aug 2026 13:44:57 +0200 Subject: none --- src/moves.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/moves.cpp') diff --git a/src/moves.cpp b/src/moves.cpp index 163bb8c..803538b 100644 --- a/src/moves.cpp +++ b/src/moves.cpp @@ -417,6 +417,13 @@ void GenerateCastlingMoves(int from, Game *g, std::vector &moves) { bool oneToLeft = g->PieceBitboard & (1ULL << (from - 1)); bool twoToLeft = g->PieceBitboard & (1ULL << (from - 2)); bool threeToLeft = g->PieceBitboard & (1ULL << (from - 3)); + + Position kingPosition = FindKing(g, g->turn); + + bool check = IsSquareAttacked(g, kingPosition, !g->turn); + if (check) { + return; + } if (g->turn) { // white if (!oneToRight && !twoToRight && g->whiteCastleKing) { -- cgit v1.2.3