Castling through check, like walking into check, is supposed to be tested
through early move generation in the reply node. But this early generation
was triggered by testing whether the 'to-piece' was a King, while the way
castling is implemented promotes the King to a Rook. This way castling
escaped the test. Now early move generation is done based on the from-piece.
int curEval, anaEval, score;
// legality
- int earlyGen = (ff->toPiece == stm+31); // King was moved
+ int earlyGen = (ff->fromPiece == stm+31); // King was moved
if(ply > 90) { if(DEBUG) Dump("maxply"); ff->depth = 0; return -ff->newEval+150; }
f.xking = location[stm+31]; // opponent King, as stm not yet toggled
if(!earlyGen && ff->mutation > 0) { // if other piece was moved (not dropped!), abort with +INF score if it was pinned