diff --git a/src/move-gen.c b/src/move-gen.c index fa3e451..9c53b9a 100644 --- a/src/move-gen.c +++ b/src/move-gen.c @@ -157,8 +157,8 @@ movelist_t *pos_all_legal(const pos_t *pos, movelist_t *dest) * - castling, if king passes an enemy-controlled square (not final square). * When immediately known, a few move flags are also applied in these cases: * - castling: M_CASTLE_{K,Q} - * - pawn capture (incl. en-passant): M_CAPTURE - * en-passant: M_EN_PASSANT + * - pawn capture (excl. en-passant): M_CAPTURE + * - en-passant: M_EN_PASSANT * - pawn double push: M_DPUSH * - promotion: M_PROMOTION * - promotion and capture @@ -311,18 +311,18 @@ int pos_gen_pseudomoves(pos_t *pos) bitboard_t rel_rank1 = bb_rel_rank(RANK_1, us); from = pos->king[us]; square_t from_square[2] = { E1, E8 }; /* verify king is on E1/E8 */ - bug_on(CAN_CASTLE(pos->castle, us) && from != from_square[us]); + bug_on(can_castle(pos->castle, us) && from != from_square[us]); /* For castle, we check the opponent attacks on squares between from and to. * To square attack check will be done in gen_is_legal. */ - if (CAN_OO(pos->castle, us)) { + if (can_oo(pos->castle, us)) { bitboard_t occmask = rel_rank1 & (FILE_Fbb | FILE_Gbb); if (!(occ & occmask) && !sq_attackers(pos, occ, from+1, them)) { /* f1/f8 */ moves[nmoves++] = move_make_flags(from, from + 2, M_CASTLE_K); } } - if (CAN_OOO(pos->castle, us)) { + if (can_ooo(pos->castle, us)) { bitboard_t occmask = rel_rank1 & (FILE_Bbb | FILE_Cbb | FILE_Dbb); if (!(occ & occmask) && !sq_attackers(pos, occ, from-1, them)) { /* d1/d8 */ diff --git a/src/move.c b/src/move.c index 19d8801..1154e11 100644 --- a/src/move.c +++ b/src/move.c @@ -110,7 +110,7 @@ char *move_str(char *dst, const move_t move, __unused const int flags) sprintf(dst, "%s%s%n", sq_to_string(from), sq_to_string(to), &len); if (is_promotion(move)) { - piece_t promoted = move_promoted(move); + piece_t promoted = (piece_t) move_promoted(move); sprintf(dst + len, "%s", piece_to_low(promoted)); } return dst; @@ -147,8 +147,8 @@ static int _moves_cmp_bysquare(const void *p1, const void *p2) square_t t1 = move_to(m1); square_t f2 = move_from(m2); square_t t2 = move_to(m2); - piece_t prom1 = move_promoted(m1); - piece_t prom2 = move_promoted(m2); + piece_type_t prom1 = move_promoted(m1); + piece_type_t prom2 = move_promoted(m2); if (f1 < f2) return -1; if (f1 > f2) return 1; /* f1 == f2 */ diff --git a/src/move.h b/src/move.h index cc531ba..19fbb66 100644 --- a/src/move.h +++ b/src/move.h @@ -19,8 +19,8 @@ #include "board.h" /* move structure: - * 3 3 2 2 1 1 1 1 1 1 - * 1 0 5 3 8 7 5 4 2 1 6 5 0 + * 3 3 2 2 1 1 1 1 1 1 + * 1 0 4 3 8 7 5 4 2 1 6 5 0 * S UUUUUUU FFFFFF ccc ppp tttttt ffffff * * bits len off range type mask get desc @@ -84,7 +84,7 @@ static inline square_t move_to(move_t move) return (move >> M_OFF_TO) & 077; } -static inline piece_t move_promoted(move_t move) +static inline piece_type_t move_promoted(move_t move) { return (move >> M_OFF_PROMOTED) & 07; } @@ -94,7 +94,6 @@ static inline piece_type_t move_captured(move_t move) return (move >> M_OFF_CAPTURED) & 07; } - static inline move_t move_make(square_t from, square_t to) { return (to << M_OFF_TO) | from; @@ -112,7 +111,7 @@ static inline move_t move_make_capture(square_t from, square_t to) static inline move_t move_make_enpassant(square_t from, square_t to) { - return move_make_flags(from, to, M_CAPTURE | M_ENPASSANT); + return move_make_flags(from, to, M_ENPASSANT); } static inline move_t move_make_promote(square_t from, square_t to,