-inline Bitboard attacks_bb(Square s, Bitboard occ) {
- return (Pt == ROOK ? RAttacks : BAttacks)[s][magic_index<Pt>(s, occ)];
+inline Bitboard attacks_bb(Square s, Bitboard occupied) {
+ return (Pt == ROOK ? RookAttacks : BishopAttacks)[s][magic_index<Pt>(s, occupied)];
+}
+
+inline Bitboard attacks_bb(Piece pc, Square s, Bitboard occupied) {
+
+ switch (type_of(pc))
+ {
+ case BISHOP: return attacks_bb<BISHOP>(s, occupied);
+ case ROOK : return attacks_bb<ROOK>(s, occupied);
+ case QUEEN : return attacks_bb<BISHOP>(s, occupied) | attacks_bb<ROOK>(s, occupied);
+ default : return StepAttacksBB[pc][s];
+ }