From: H.G.Muller Date: Wed, 2 Jul 2014 10:37:18 +0000 (+0200) Subject: Fix null-move entry during play X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=00360e226b6c74d58365901e8cc5941a5ec9ff11 Fix null-move entry during play Null moving by clicking the clock was only accepted in Edit Game and Analyze mode, while in Chu Shogi and spin-offs it is also allowed during play. An F_NULL_MOVE flag was introduced to make it easy to test for such variants, and Machine White/Black mode now also interpret clock clicks as a null move if the opponent's flag has not yet fallen. --- diff --git a/backend.c b/backend.c index 9d659e2..3d9f020 100644 --- a/backend.c +++ b/backend.c @@ -413,6 +413,11 @@ PosFlags (index) case VariantGrand: flags &= ~F_ALL_CASTLE_OK; break; + case VariantChu: + case VariantChuChess: + case VariantLion: + flags |= F_NULL_MOVE; + break; default: break; } @@ -15289,7 +15294,8 @@ ClockClick (int which) if (gameMode == EditPosition || gameMode == IcsExamining) { if(!appData.pieceMenu && blackPlaysFirst) EditPositionMenuEvent(ClearBoard, 0, 0); SetBlackToPlayEvent(); - } else if ((gameMode == AnalyzeMode || gameMode == EditGame) && !blackFlag && WhiteOnMove(currentMove)) { + } else if ((gameMode == AnalyzeMode || gameMode == EditGame || + gameMode == MachinePlaysBlack && PosFlags(0) & F_NULL_MOVE && !blackFlag) && WhiteOnMove(currentMove)) { UserMoveEvent((int)EmptySquare, DROP_RANK, 0, 0, 0); // [HGM] multi-move: if not out of time, enters null move } else if (shiftKey) { AdjustClock(which, -1); @@ -15301,7 +15307,8 @@ ClockClick (int which) if (gameMode == EditPosition || gameMode == IcsExamining) { if(!appData.pieceMenu && !blackPlaysFirst) EditPositionMenuEvent(ClearBoard, 0, 0); SetWhiteToPlayEvent(); - } else if ((gameMode == AnalyzeMode || gameMode == EditGame) && !whiteFlag && !WhiteOnMove(currentMove)) { + } else if ((gameMode == AnalyzeMode || gameMode == EditGame || + gameMode == MachinePlaysWhite && PosFlags(0) & F_NULL_MOVE && !whiteFlag) && !WhiteOnMove(currentMove)) { UserMoveEvent((int)EmptySquare, DROP_RANK, 0, 0, 0); // [HGM] multi-move } else if (shiftKey) { AdjustClock(which, -1); diff --git a/moves.h b/moves.h index b4b9eb3..a86cca5 100644 --- a/moves.h +++ b/moves.h @@ -81,6 +81,7 @@ typedef void (*MoveCallback) P((Board board, int flags, ChessMove kind, destroying your own king is illegal */ #define F_FRC_TYPE_CASTLING 256 /* generate castlings as captures of own Rook */ #define F_MANDATORY_CAPTURE 0x200 +#define F_NULL_MOVE 0x400 /* Special epfile values. [HGM] positive values are non-reversible moves! */ #define EP_NONE (-6) /* [HGM] Tricky! order matters: */