Fix check test
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 11 Feb 2018 11:11:54 +0000 (12:11 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 11 Feb 2018 11:11:54 +0000 (12:11 +0100)
When locating the check tet in a separate routine, the stack frame of
the paret node was used to return the result, rather than that of the
node itself.

dropper.c

index dff73d0..a2d9e3d 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -980,8 +980,8 @@ CheckTest (int stm, StackFrame *ff, StackFrame *f)
            if(x == king) f->checker = ff->toSqr, f->checkDir = v, f->checkDist = dist[vec]; // ray is clear, distant check
        } else if(match & C_CONTACT) f->checker = ff->toSqr, f->checkDir = 0; // contact check
        if(ff->mutation != -1) { // board move (no drop)
-           DiscoTest(stm, ff->fromSqr, king, ff);
-           if(board[ff->captSqr] == 0) DiscoTest(stm, ff->captSqr, king, ff); // e.p. capture can discover check as well
+           DiscoTest(stm, ff->fromSqr, king, f);
+           if(board[ff->captSqr] == 0) DiscoTest(stm, ff->captSqr, king, f); // e.p. capture can discover check as well
        }
     }
 }