The Spartan patch had broken the CheckTest for Xiangqi, because cl.check
was cleared after the King-facing test, rather than before it.
for (cl.fking = BOARD_LEFT+0; cl.fking < BOARD_RGHT; cl.fking++)
for (cl.rking = 0; cl.rking < BOARD_HEIGHT; cl.rking++) {
if (board[cl.rking][cl.fking] == king) {
+ cl.check = 0;
if(gameInfo.variant == VariantXiangqi) {
/* [HGM] In Xiangqi opposing Kings means check as well */
int i, dir;
board[i][cl.fking] == (dir>0 ? BlackWazir : WhiteWazir) )
cl.check++;
}
- cl.check = 0;
GenPseudoLegal(board, flags ^ F_WHITE_ON_MOVE, CheckTestCallback, (VOIDSTAR) &cl);
if(gameInfo.variant != VariantSpartan || cl.check == 0) // in Spartan Chess go on to test if other King is checked too
goto undo_move; /* 2-level break */