mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Fix a couple of MSVC casting warnings
Also removed some trailing whitespaces and aligned indentation to current standard. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
56e09b4cc8
commit
b1ac6c69a0
1 changed files with 80 additions and 80 deletions
|
@ -143,28 +143,28 @@ void Position::from_fen(const string& fen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
while(strchr("KQkqabcdefghABCDEFGH-", fen[i])) {
|
while (strchr("KQkqabcdefghABCDEFGH-", fen[i])) {
|
||||||
if (fen[i] == '-')
|
if (fen[i] == '-')
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(fen[i] == 'K') allow_oo(WHITE);
|
else if (fen[i] == 'K') allow_oo(WHITE);
|
||||||
else if(fen[i] == 'Q') allow_ooo(WHITE);
|
else if (fen[i] == 'Q') allow_ooo(WHITE);
|
||||||
else if(fen[i] == 'k') allow_oo(BLACK);
|
else if (fen[i] == 'k') allow_oo(BLACK);
|
||||||
else if(fen[i] == 'q') allow_ooo(BLACK);
|
else if (fen[i] == 'q') allow_ooo(BLACK);
|
||||||
else if(fen[i] >= 'A' && fen[i] <= 'H') {
|
else if (fen[i] >= 'A' && fen[i] <= 'H') {
|
||||||
File rookFile, kingFile = FILE_NONE;
|
File rookFile, kingFile = FILE_NONE;
|
||||||
for(Square square = SQ_B1; square <= SQ_G1; square++)
|
for (Square square = SQ_B1; square <= SQ_G1; square++)
|
||||||
if(piece_on(square) == WK)
|
if (piece_on(square) == WK)
|
||||||
kingFile = square_file(square);
|
kingFile = square_file(square);
|
||||||
if(kingFile == FILE_NONE) {
|
if (kingFile == FILE_NONE) {
|
||||||
std::cout << "Error in FEN at character " << i << std::endl;
|
std::cout << "Error in FEN at character " << i << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initialKFile = kingFile;
|
initialKFile = kingFile;
|
||||||
rookFile = File(fen[i] - 'A') + FILE_A;
|
rookFile = File(fen[i] - 'A') + FILE_A;
|
||||||
if(rookFile < initialKFile) {
|
if (rookFile < initialKFile) {
|
||||||
allow_ooo(WHITE);
|
allow_ooo(WHITE);
|
||||||
initialQRFile = rookFile;
|
initialQRFile = rookFile;
|
||||||
}
|
}
|
||||||
|
@ -173,18 +173,18 @@ void Position::from_fen(const string& fen) {
|
||||||
initialKRFile = rookFile;
|
initialKRFile = rookFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(fen[i] >= 'a' && fen[i] <= 'h') {
|
else if (fen[i] >= 'a' && fen[i] <= 'h') {
|
||||||
File rookFile, kingFile = FILE_NONE;
|
File rookFile, kingFile = FILE_NONE;
|
||||||
for(Square square = SQ_B8; square <= SQ_G8; square++)
|
for (Square square = SQ_B8; square <= SQ_G8; square++)
|
||||||
if(piece_on(square) == BK)
|
if (piece_on(square) == BK)
|
||||||
kingFile = square_file(square);
|
kingFile = square_file(square);
|
||||||
if(kingFile == FILE_NONE) {
|
if (kingFile == FILE_NONE) {
|
||||||
std::cout << "Error in FEN at character " << i << std::endl;
|
std::cout << "Error in FEN at character " << i << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initialKFile = kingFile;
|
initialKFile = kingFile;
|
||||||
rookFile = File(fen[i] - 'a') + FILE_A;
|
rookFile = File(fen[i] - 'a') + FILE_A;
|
||||||
if(rookFile < initialKFile) {
|
if (rookFile < initialKFile) {
|
||||||
allow_ooo(BLACK);
|
allow_ooo(BLACK);
|
||||||
initialQRFile = rookFile;
|
initialQRFile = rookFile;
|
||||||
}
|
}
|
||||||
|
@ -281,9 +281,9 @@ const string Position::to_fen() const {
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (can_castle_kingside(WHITE))
|
if (can_castle_kingside(WHITE))
|
||||||
fen += toupper(file_to_char(initialKRFile));
|
fen += char(toupper(file_to_char(initialKRFile)));
|
||||||
if (can_castle_queenside(WHITE))
|
if (can_castle_queenside(WHITE))
|
||||||
fen += toupper(file_to_char(initialQRFile));
|
fen += char(toupper(file_to_char(initialQRFile)));
|
||||||
if (can_castle_kingside(BLACK))
|
if (can_castle_kingside(BLACK))
|
||||||
fen += file_to_char(initialKRFile);
|
fen += file_to_char(initialKRFile);
|
||||||
if (can_castle_queenside(BLACK))
|
if (can_castle_queenside(BLACK))
|
||||||
|
@ -1574,7 +1574,7 @@ Key Position::compute_pawn_key() const {
|
||||||
for (Color c = WHITE; c <= BLACK; c++)
|
for (Color c = WHITE; c <= BLACK; c++)
|
||||||
{
|
{
|
||||||
b = pieces(PAWN, c);
|
b = pieces(PAWN, c);
|
||||||
while(b)
|
while (b)
|
||||||
{
|
{
|
||||||
s = pop_1st_bit(&b);
|
s = pop_1st_bit(&b);
|
||||||
result ^= zobrist[c][PAWN][s];
|
result ^= zobrist[c][PAWN][s];
|
||||||
|
@ -1618,7 +1618,7 @@ Score Position::compute_value() const {
|
||||||
for (PieceType pt = PAWN; pt <= KING; pt++)
|
for (PieceType pt = PAWN; pt <= KING; pt++)
|
||||||
{
|
{
|
||||||
b = pieces(pt, c);
|
b = pieces(pt, c);
|
||||||
while(b)
|
while (b)
|
||||||
{
|
{
|
||||||
s = pop_1st_bit(&b);
|
s = pop_1st_bit(&b);
|
||||||
assert(piece_on(s) == piece_of_color_and_type(c, pt));
|
assert(piece_on(s) == piece_of_color_and_type(c, pt));
|
||||||
|
@ -1990,9 +1990,9 @@ bool Position::is_ok(int* failedStep) const {
|
||||||
if (failedStep) (*failedStep)++;
|
if (failedStep) (*failedStep)++;
|
||||||
if (debugPieceList)
|
if (debugPieceList)
|
||||||
{
|
{
|
||||||
for(Color c = WHITE; c <= BLACK; c++)
|
for (Color c = WHITE; c <= BLACK; c++)
|
||||||
for(PieceType pt = PAWN; pt <= KING; pt++)
|
for (PieceType pt = PAWN; pt <= KING; pt++)
|
||||||
for(int i = 0; i < pieceCount[c][pt]; i++)
|
for (int i = 0; i < pieceCount[c][pt]; i++)
|
||||||
{
|
{
|
||||||
if (piece_on(piece_list(c, pt, i)) != piece_of_color_and_type(c, pt))
|
if (piece_on(piece_list(c, pt, i)) != piece_of_color_and_type(c, pt))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue