From: H.G.Muller Date: Wed, 2 Jul 2014 12:34:53 +0000 (+0200) Subject: Fix typing of null moves X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c591aa5f691ddd2fe00a64993e006d105b47f4a3;p=xboard.git Fix typing of null moves Entering a null move through the move type-in could fail because the to-square coordinates (not used in its encoding) could have invalid values, which would reject the move in an early stage of UserMoveEvent(). Null moves are now exempted from this vaidity test, while variants where null moves are legal now accept them in any gameMode. --- diff --git a/backend.c b/backend.c index b269bf3..f05359c 100644 --- a/backend.c +++ b/backend.c @@ -6972,7 +6972,7 @@ UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar) return; } - if(toX < 0 || toY < 0) return; + if((toX < 0 || toY < 0) && (fromY != DROP_RANK || fromX != EmptySquare)) return; pup = boards[currentMove][toY][toX]; /* [HGM] If move started in holdings, it means a drop. Convert to standard form */ @@ -6992,7 +6992,7 @@ UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar) moveType = LegalityTest(boards[currentMove], PosFlags(currentMove), fromY, fromX, toY, toX, promoChar); - if(fromY == DROP_RANK && fromX == EmptySquare && (gameMode == AnalyzeMode || gameMode == EditGame)) moveType = NormalMove; + if(fromY == DROP_RANK && fromX == EmptySquare && (gameMode == AnalyzeMode || gameMode == EditGame || PosFlags(0) & F_NULL_MOVE)) moveType = NormalMove; /* [HGM] but possibly ignore an IllegalMove result */ if (appData.testLegality) {