X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=0b2a0cca4e0f9afab86bbf667f0e4160947a6bb8;hp=6378d0ba2ff07a3ce608ab9a9b89c5976d02a607;hb=e6310b3469b07b6bbecf8d8f75367a655090f22b;hpb=68d61b80c60a81055a2ffb2e251a237b979e9b31 diff --git a/src/position.h b/src/position.h index 6378d0ba..0b2a0cca 100644 --- a/src/position.h +++ b/src/position.h @@ -105,11 +105,11 @@ public: Bitboard pieces(Color c, PieceType pt) const; Bitboard pieces(Color c, PieceType pt1, PieceType pt2) const; Piece piece_on(Square s) const; - Square king_square(Color c) const; Square ep_square() const; bool empty(Square s) const; template int count(Color c) const; - template const Square* list(Color c) const; + template const Square* squares(Color c) const; + template Square square(Color c) const; // Castling int can_castle(Color c) const; @@ -254,12 +254,13 @@ template inline int Position::count(Color c) const { return pieceCount[c][Pt]; } -template inline const Square* Position::list(Color c) const { +template inline const Square* Position::squares(Color c) const { return pieceList[c][Pt]; } -inline Square Position::king_square(Color c) const { - return pieceList[c][KING][0]; +template inline Square Position::square(Color c) const { + assert(pieceCount[c][Pt] == 1); + return pieceList[c][Pt][0]; } inline Square Position::ep_square() const { @@ -362,7 +363,7 @@ inline void Position::set_nodes_searched(uint64_t n) { inline bool Position::opposite_bishops() const { return pieceCount[WHITE][BISHOP] == 1 && pieceCount[BLACK][BISHOP] == 1 - && opposite_colors(pieceList[WHITE][BISHOP][0], pieceList[BLACK][BISHOP][0]); + && opposite_colors(square(WHITE), square(BLACK)); } inline bool Position::is_chess960() const {