Avoid misuse of StepAttacksBB for pawns

Make it explicit that first index of StepAttacksBB is a piece, not a piece type.

No functional change

Closes #1083
This commit is contained in:
snicolet
2017-04-25 17:57:30 -07:00
committed by Joona Kiiski
parent d06a8d0c18
commit 49a9d4cf99
2 changed files with 3 additions and 2 deletions

View File

@@ -273,6 +273,7 @@ inline Square Position::castling_rook_square(CastlingRight cr) const {
template<PieceType Pt>
inline Bitboard Position::attacks_from(Square s) const {
assert(Pt != PAWN);
return Pt == BISHOP || Pt == ROOK ? attacks_bb<Pt>(s, byTypeBB[ALL_PIECES])
: Pt == QUEEN ? attacks_from<ROOK>(s) | attacks_from<BISHOP>(s)
: StepAttacksBB[Pt][s];