X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=90d0135a4d0dbe246aa38daa54b94d28820d5ad4;hp=c9255f31eb4e5245b867c0694d2d358a72dc77a0;hb=ad1f28bc1c1c5426fb8ab246f5d43ad57002b4d5;hpb=37d551fb39a4e631946156fcb76cde7fcde37ba4 diff --git a/src/movegen.cpp b/src/movegen.cpp index c9255f31..90d0135a 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -21,6 +21,7 @@ #include "bitcount.h" #include "movegen.h" +#include "position.h" // Simple macro to wrap a very common while loop, no facny, no flexibility, // hardcoded list name 'mlist' and from square 'from'. @@ -151,7 +152,6 @@ namespace { template MoveStack* generate(const Position& pos, MoveStack* mlist) { - assert(pos.is_ok()); assert(!pos.in_check()); Color us = pos.side_to_move(); @@ -202,7 +202,6 @@ template MoveStack* generate(const Position& pos, MoveStack* mli template<> MoveStack* generate(const Position& pos, MoveStack* mlist) { - assert(pos.is_ok()); assert(!pos.in_check()); Bitboard b, dc; @@ -213,7 +212,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) assert(pos.piece_on(ksq) == make_piece(opposite_color(us), KING)); // Discovered non-capture checks - b = dc = pos.discovered_check_candidates(us); + b = dc = pos.discovered_check_candidates(); while (b) { @@ -243,7 +242,6 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) template<> MoveStack* generate(const Position& pos, MoveStack* mlist) { - assert(pos.is_ok()); assert(pos.in_check()); Bitboard b, target; @@ -315,10 +313,8 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { template<> MoveStack* generate(const Position& pos, MoveStack* mlist) { - assert(pos.is_ok()); - MoveStack *last, *cur = mlist; - Bitboard pinned = pos.pinned_pieces(pos.side_to_move()); + Bitboard pinned = pos.pinned_pieces(); last = pos.in_check() ? generate(pos, mlist) : generate(pos, mlist); @@ -362,7 +358,6 @@ namespace { inline MoveStack* generate_promotions(const Position& pos, MoveStack* mlist, Bitboard pawnsOn7, Bitboard target) { const Bitboard TFileABB = (Delta == DELTA_NE || Delta == DELTA_SE ? FileABB : FileHBB); - const Color Them = (Delta > 0 ? BLACK : WHITE); Bitboard b; Square to; @@ -390,7 +385,7 @@ namespace { // This is the only possible under promotion that can give a check // not already included in the queen-promotion. if ( Type == MV_CHECK - && bit_is_set(pos.attacks_from(to), pos.king_square(Them))) + && bit_is_set(pos.attacks_from(to), pos.king_square(Delta > 0 ? BLACK : WHITE))) (*mlist++).move = make_promotion_move(to - Delta, to, KNIGHT); else (void)pos; // Silence a warning under MSVC }