fen2pos: no more pos_checkers etc... position.c: pos_check -> pos_ok (bool)

This commit is contained in:
2024-03-27 12:40:16 +01:00
parent 08ba989170
commit 09afd98971
5 changed files with 32 additions and 19 deletions

View File

@@ -75,7 +75,7 @@ static const char *castle_str = "KQkq";
static int fen_check(pos_t *pos)
{
char *colstr[2] = { "white", "black"};
int error = 0, warning = 0;
int warning = 0;
/* en passant, depends on who plays next */
if (pos->en_passant != SQUARE_NONE) {
@@ -130,13 +130,7 @@ static int fen_check(pos_t *pos)
}
}
}
if (!(error = pos_check(pos, 0))) {
/* TODO: Should it really be here ? */
pos->checkers = pos_checkers(pos, pos->turn);
pos->pinners = pos_king_pinners(pos, pos->turn);
pos->blockers = pos_king_blockers(pos, pos->turn, pos->pinners);
}
return error ? -1: warning;
return pos_ok(pos, 0) ? warning: -1;
}
/**