fixed signature
This commit is contained in:
parent
da55f0085f
commit
fea3f6c98a
@ -2,14 +2,24 @@
|
|||||||
|
|
||||||
#include "../board.hpp"
|
#include "../board.hpp"
|
||||||
|
|
||||||
std::vector<Move> legal_moves(const Piece p, const Board& b, const Coords xy) {
|
std::vector<Move> legal_moves(
|
||||||
|
const Piece p,
|
||||||
|
const Board& b,
|
||||||
|
const Coords xy,
|
||||||
|
bool looking_for_check = false
|
||||||
|
) {
|
||||||
|
std::vector<Move> ret;
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case Piece::Pawn:
|
case Piece::Pawn:
|
||||||
return pawn_moves(b, xy);
|
ret = pawn_moves(b, xy);
|
||||||
case Piece::Bishop:
|
case Piece::Bishop:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!looking_for_check)
|
||||||
|
return keep_only_blocking(ret, b);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ enum Colour : int8_t {
|
|||||||
class Board;
|
class Board;
|
||||||
struct Coords;
|
struct Coords;
|
||||||
|
|
||||||
std::vector<Move> legal_moves(const Piece, const Board&, const Coords);
|
std::vector<Move> legal_moves(const Piece, const Board&, const Coords, bool);
|
||||||
|
|
||||||
std::vector<Move> pawn_moves(const Board&, const Coords);
|
std::vector<Move> pawn_moves(const Board&, const Coords);
|
||||||
std::vector<Move> rook_moves(const Board&, const Coords);
|
std::vector<Move> rook_moves(const Board&, const Coords);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user