diff --git a/cpp/src/board.cpp b/cpp/src/board.cpp index f45c62d..6d2674a 100644 --- a/cpp/src/board.cpp +++ b/cpp/src/board.cpp @@ -287,7 +287,8 @@ bool Board::is_check_for(int8_t colour) const { std::vector moves = legal_moves(this->squares[i], *this, Coords::from_index(i), true); std::vector targets = to_target_square(moves); - if (std::find(targets.begin(), targets.end(), i) != targets.end()) + if (std::find(targets.begin(), targets.end(), king_idx) + != targets.end()) return true; } return false;