1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Remove xxx_of_color() for real

Remove also from assert expressions. Was hidden
in release mode.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-02-17 17:26:15 +01:00
parent 7013efce4e
commit c45818e9f8
4 changed files with 23 additions and 23 deletions

View file

@ -926,7 +926,7 @@ namespace {
{ {
Square s = pop_1st_bit(&b); Square s = pop_1st_bit(&b);
assert(pos.piece_on(s) == pawn_of_color(us)); assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN));
assert(pos.pawn_is_passed(us, s)); assert(pos.pawn_is_passed(us, s));
int r = int(relative_rank(us, s) - RANK_2); int r = int(relative_rank(us, s) - RANK_2);
@ -1077,7 +1077,7 @@ namespace {
void evaluate_trapped_bishop_a7h7(const Position &pos, Square s, Color us, void evaluate_trapped_bishop_a7h7(const Position &pos, Square s, Color us,
EvalInfo &ei) { EvalInfo &ei) {
assert(square_is_ok(s)); assert(square_is_ok(s));
assert(pos.piece_on(s) == bishop_of_color(us)); assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP));
Square b6 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B6 : SQ_G6); Square b6 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B6 : SQ_G6);
Square b8 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B8 : SQ_G8); Square b8 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B8 : SQ_G8);
@ -1104,7 +1104,7 @@ namespace {
assert(Chess960); assert(Chess960);
assert(square_is_ok(s)); assert(square_is_ok(s));
assert(pos.piece_on(s) == bishop_of_color(us)); assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP));
if (square_file(s) == FILE_A) if (square_file(s) == FILE_A)
{ {

View file

@ -175,7 +175,7 @@ int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc) {
Square ksq = pos.king_square(opposite_color(us)); Square ksq = pos.king_square(opposite_color(us));
MoveStack* mlist_start = mlist; MoveStack* mlist_start = mlist;
assert(pos.piece_on(ksq) == king_of_color(opposite_color(us))); assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING));
// Pieces moves // Pieces moves
mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq); mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq);
@ -215,7 +215,7 @@ int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned) {
Square ksq = pos.king_square(us); Square ksq = pos.king_square(us);
MoveStack* mlist_start = mlist; MoveStack* mlist_start = mlist;
assert(pos.piece_on(ksq) == king_of_color(us)); assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
// The bitboard of occupied pieces without our king // The bitboard of occupied pieces without our king
Bitboard b_noKing = pos.occupied_squares(); Bitboard b_noKing = pos.occupied_squares();
@ -400,7 +400,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
return false; return false;
assert(pos.square_is_empty(to)); assert(pos.square_is_empty(to));
assert(pos.piece_on(to - pawn_push(us)) == pawn_of_color(them)); assert(pos.piece_on(to - pawn_push(us)) == piece_of_color_and_type(them, PAWN));
// The move is pseudo-legal, check if it is also legal // The move is pseudo-legal, check if it is also legal
return pos.pl_move_is_legal(m, pinned); return pos.pl_move_is_legal(m, pinned);
@ -417,7 +417,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
assert(from == pos.king_square(us)); assert(from == pos.king_square(us));
assert(to == pos.initial_kr_square(us)); assert(to == pos.initial_kr_square(us));
assert(pos.piece_on(to) == rook_of_color(us)); assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK));
Square g1 = relative_square(us, SQ_G1); Square g1 = relative_square(us, SQ_G1);
Square f1 = relative_square(us, SQ_F1); Square f1 = relative_square(us, SQ_F1);
@ -450,7 +450,7 @@ bool move_is_legal(const Position& pos, const Move m, Bitboard pinned) {
assert(from == pos.king_square(us)); assert(from == pos.king_square(us));
assert(to == pos.initial_qr_square(us)); assert(to == pos.initial_qr_square(us));
assert(pos.piece_on(to) == rook_of_color(us)); assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK));
Square c1 = relative_square(us, SQ_C1); Square c1 = relative_square(us, SQ_C1);
Square d1 = relative_square(us, SQ_D1); Square d1 = relative_square(us, SQ_D1);
@ -866,7 +866,7 @@ namespace {
Color them = opposite_color(us); Color them = opposite_color(us);
Square ksq = pos.king_square(us); Square ksq = pos.king_square(us);
assert(pos.piece_on(ksq) == king_of_color(us)); assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us)); Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us));
Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1); Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
@ -874,7 +874,7 @@ namespace {
Square s; Square s;
bool illegal = false; bool illegal = false;
assert(pos.piece_on(rsq) == rook_of_color(us)); assert(pos.piece_on(rsq) == piece_of_color_and_type(us, ROOK));
// It is a bit complicated to correctly handle Chess960 // It is a bit complicated to correctly handle Chess960
for (s = Min(ksq, s1); s <= Max(ksq, s1); s++) for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)

View file

@ -216,7 +216,7 @@ PawnInfo *PawnInfoTable::get_pawn_info(const Position &pos) {
File f = square_file(s); File f = square_file(s);
Rank r = square_rank(s); Rank r = square_rank(s);
assert(pos.piece_on(s) == pawn_of_color(us)); assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN));
// The file containing the pawn is not half open // The file containing the pawn is not half open
pi->halfOpenFiles[us] &= ~(1 << f); pi->halfOpenFiles[us] &= ~(1 << f);

View file

@ -493,7 +493,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
Square ksq = king_square(us); Square ksq = king_square(us);
assert(color_of_piece_on(from) == us); assert(color_of_piece_on(from) == us);
assert(piece_on(ksq) == king_of_color(us)); assert(piece_on(ksq) == piece_of_color_and_type(us, KING));
// En passant captures are a tricky special case. Because they are // En passant captures are a tricky special case. Because they are
// rather uncommon, we do it simply by testing whether the king is attacked // rather uncommon, we do it simply by testing whether the king is attacked
@ -505,8 +505,8 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
Bitboard b = occupied_squares(); Bitboard b = occupied_squares();
assert(to == ep_square()); assert(to == ep_square());
assert(piece_on(from) == pawn_of_color(us)); assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
assert(piece_on(capsq) == pawn_of_color(them)); assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN));
assert(piece_on(to) == EMPTY); assert(piece_on(to) == EMPTY);
clear_bit(&b, from); clear_bit(&b, from);
@ -554,7 +554,7 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
Square ksq = king_square(them); Square ksq = king_square(them);
assert(color_of_piece_on(from) == us); assert(color_of_piece_on(from) == us);
assert(piece_on(ksq) == king_of_color(them)); assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
// Proceed according to the type of the moving piece // Proceed according to the type of the moving piece
switch (type_of_piece_on(from)) switch (type_of_piece_on(from))
@ -940,8 +940,8 @@ void Position::do_castle_move(Move m) {
Square rfrom = move_to(m); // HACK: See comment at beginning of function Square rfrom = move_to(m); // HACK: See comment at beginning of function
Square kto, rto; Square kto, rto;
assert(piece_on(kfrom) == king_of_color(us)); assert(piece_on(kfrom) == piece_of_color_and_type(us, KING));
assert(piece_on(rfrom) == rook_of_color(us)); assert(piece_on(rfrom) == piece_of_color_and_type(us, ROOK));
// Find destination squares for king and rook // Find destination squares for king and rook
if (rfrom > kfrom) // O-O if (rfrom > kfrom) // O-O
@ -1039,7 +1039,7 @@ void Position::do_promotion_move(Move m, UndoInfo &u) {
to = move_to(m); to = move_to(m);
assert(relative_rank(us, to) == RANK_8); assert(relative_rank(us, to) == RANK_8);
assert(piece_on(from) == pawn_of_color(us)); assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
assert(color_of_piece_on(to) == them || square_is_empty(to)); assert(color_of_piece_on(to) == them || square_is_empty(to));
capture = type_of_piece_on(to); capture = type_of_piece_on(to);
@ -1136,8 +1136,8 @@ void Position::do_ep_move(Move m) {
assert(to == epSquare); assert(to == epSquare);
assert(relative_rank(us, to) == RANK_6); assert(relative_rank(us, to) == RANK_6);
assert(piece_on(to) == EMPTY); assert(piece_on(to) == EMPTY);
assert(piece_on(from) == pawn_of_color(us)); assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
assert(piece_on(capsq) == pawn_of_color(them)); assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN));
// Remove captured piece // Remove captured piece
clear_bit(&(byColorBB[them]), capsq); clear_bit(&(byColorBB[them]), capsq);
@ -1314,8 +1314,8 @@ void Position::undo_castle_move(Move m) {
rto = relative_square(us, SQ_D1); rto = relative_square(us, SQ_D1);
} }
assert(piece_on(kto) == king_of_color(us)); assert(piece_on(kto) == piece_of_color_and_type(us, KING));
assert(piece_on(rto) == rook_of_color(us)); assert(piece_on(rto) == piece_of_color_and_type(us, ROOK));
// Remove pieces from destination squares // Remove pieces from destination squares
clear_bit(&(byColorBB[us]), kto); clear_bit(&(byColorBB[us]), kto);
@ -1452,7 +1452,7 @@ void Position::undo_ep_move(Move m) {
assert(to == ep_square()); assert(to == ep_square());
assert(relative_rank(us, to) == RANK_6); assert(relative_rank(us, to) == RANK_6);
assert(piece_on(to) == pawn_of_color(us)); assert(piece_on(to) == piece_of_color_and_type(us, PAWN));
assert(piece_on(from) == EMPTY); assert(piece_on(from) == EMPTY);
assert(piece_on(capsq) == EMPTY); assert(piece_on(capsq) == EMPTY);