made CastleSide a normal enum again to use &
Some checks failed
tagged-release / Tagged Release (push) Has been cancelled
Some checks failed
tagged-release / Tagged Release (push) Has been cancelled
This commit is contained in:
parent
f5292fa6d7
commit
472f9e4c7c
@ -1,7 +1,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
enum class CastleSide : int8_t {
|
||||
Neither = 0,
|
||||
King = 1,
|
||||
Queen = 2,
|
||||
enum CastleSide : int8_t {
|
||||
NeitherSide = 0,
|
||||
KingSide = 1,
|
||||
QueenSide = 2,
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ struct Move {
|
||||
int8_t target_square;
|
||||
|
||||
bool is_capturing = false;
|
||||
CastleSide castle_side = CastleSide::Neither;
|
||||
CastleSide castle_side = CastleSide::NeitherSide;
|
||||
bool en_passant = false;
|
||||
int8_t promoting_to = 0;
|
||||
};
|
||||
|
@ -53,22 +53,22 @@ std::vector<Move> king_moves(const Board& b, const Coords xy) {
|
||||
? b.w_castle_rights
|
||||
: b.b_castle_rights;
|
||||
|
||||
if (castling_rights == CastleSide::Neither)
|
||||
if (castling_rights == CastleSide::NeitherSide)
|
||||
return ret;
|
||||
|
||||
if (castling_rights == CastleSide::King && is_clear_king_side(b, xy)) {
|
||||
if (castling_rights & CastleSide::KingSide && is_clear_king_side(b, xy)) {
|
||||
ret.push_back(Move{
|
||||
xy.to_index(),
|
||||
Coords{6, xy.y}.to_index(),
|
||||
.castle_side = CastleSide::King
|
||||
.castle_side = CastleSide::KingSide
|
||||
});
|
||||
}
|
||||
|
||||
if (castling_rights == CastleSide::Queen && is_clear_queen_side(b, xy)) {
|
||||
if (castling_rights & CastleSide::QueenSide && is_clear_queen_side(b, xy)) {
|
||||
ret.push_back(Move{
|
||||
xy.to_index(),
|
||||
Coords{2, xy.y}.to_index(),
|
||||
.castle_side = CastleSide::Queen
|
||||
.castle_side = CastleSide::QueenSide
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user