+
+ template<GenType Type> FORCE_INLINE
+ MoveStack* generate_all_moves(const Position& pos, MoveStack* mlist, Color us,
+ Bitboard target, const CheckInfo* ci = NULL) {
+
+ mlist = (us == WHITE ? generate_pawn_moves<WHITE, Type>(pos, mlist, target, ci)
+ : generate_pawn_moves<BLACK, Type>(pos, mlist, target, ci));
+
+ mlist = generate_moves<KNIGHT, Type == QUIET_CHECKS>(pos, mlist, us, target, ci);
+ mlist = generate_moves<BISHOP, Type == QUIET_CHECKS>(pos, mlist, us, target, ci);
+ mlist = generate_moves<ROOK, Type == QUIET_CHECKS>(pos, mlist, us, target, ci);
+ mlist = generate_moves<QUEEN, Type == QUIET_CHECKS>(pos, mlist, us, target, ci);
+
+ if (Type != QUIET_CHECKS && Type != EVASIONS)
+ mlist = generate_king_moves(pos, mlist, us, target);
+
+ if (Type != CAPTURES && Type != EVASIONS && pos.can_castle(us))
+ {
+ if (pos.is_chess960())
+ {
+ mlist = generate_castle<KING_SIDE, Type == QUIET_CHECKS, true>(pos, mlist, us);
+ mlist = generate_castle<QUEEN_SIDE, Type == QUIET_CHECKS, true>(pos, mlist, us);
+ }
+ else
+ {
+ mlist = generate_castle<KING_SIDE, Type == QUIET_CHECKS, false>(pos, mlist, us);
+ mlist = generate_castle<QUEEN_SIDE, Type == QUIET_CHECKS, false>(pos, mlist, us);
+ }
+ }
+
+ return mlist;
+ }
+
+