bb: Fix crash after mirror/turn/rotate
This commit is contained in:
parent
a1f4832fe0
commit
974872e226
|
@ -1837,6 +1837,18 @@ void Position::print_board()
|
|||
}
|
||||
}
|
||||
|
||||
void Position::reset_bb()
|
||||
{
|
||||
memset(byTypeBB, 0, sizeof(byTypeBB));
|
||||
memset(byColorBB, 0, sizeof(byColorBB));
|
||||
|
||||
for (Square s = SQ_BEGIN; s < SQ_END; ++s) {
|
||||
Piece pc = board[s];
|
||||
byTypeBB[ALL_PIECES] |= byTypeBB[type_of(pc)] |= s;
|
||||
byColorBB[color_of(pc)] |= s;
|
||||
}
|
||||
}
|
||||
|
||||
void Position::mirror(vector <string> &cmdlist, bool cmdChange /*= true*/)
|
||||
{
|
||||
Piece ch;
|
||||
|
@ -1851,6 +1863,8 @@ void Position::mirror(vector <string> &cmdlist, bool cmdChange /*= true*/)
|
|||
}
|
||||
}
|
||||
|
||||
reset_bb();
|
||||
|
||||
uint64_t llp[3] = { 0 };
|
||||
|
||||
if (move < 0) {
|
||||
|
@ -1956,6 +1970,8 @@ void Position::turn(vector <string> &cmdlist, bool cmdChange /*= true*/)
|
|||
board[RANK_NB * FILE_NB + r] = ch;
|
||||
}
|
||||
|
||||
reset_bb();
|
||||
|
||||
uint64_t llp[3] = { 0 };
|
||||
|
||||
if (move < 0) {
|
||||
|
@ -2156,6 +2172,8 @@ void Position::rotate(vector <string> &cmdlist, int degrees, bool cmdChange /*=
|
|||
return;
|
||||
}
|
||||
|
||||
reset_bb();
|
||||
|
||||
uint64_t llp[3] = { 0 };
|
||||
|
||||
if (move < 0) {
|
||||
|
|
|
@ -129,6 +129,8 @@ public:
|
|||
void turn(std::vector <std::string> &cmdlist, bool cmdChange = true);
|
||||
void rotate(std::vector <std::string> &cmdlist, int degrees, bool cmdChange = true);
|
||||
|
||||
void reset_bb();
|
||||
|
||||
void create_mill_table();
|
||||
int add_mills(Square s);
|
||||
int in_how_many_mills(Square s, Color c, Square squareSelected = SQ_0);
|
||||
|
|
Loading…
Reference in New Issue