X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fjaws.c;h=19ee0659de58f6fab86cdd988007741fb2ee45f9;hb=bf1467b590e28b4dc641a3c753ce728b90d42081;hp=8aad901a977a76d31d2a67a671b36c041d7c8e40;hpb=18c97517acda747ffe9d9177c61c9bf5b1195bb6;p=xboard.git diff --git a/winboard/jaws.c b/winboard/jaws.c index 8aad901..19ee065 100644 --- a/winboard/jaws.c +++ b/winboard/jaws.c @@ -5,7 +5,7 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010 Free Software Foundation, Inc. * * XBoard borrows its colors and the bitmaps.xchess bitmap set from XChess, * which was written and is copyrighted by Wayne Christopher. @@ -162,7 +162,7 @@ PSAYSTRING RealSayString; VOID SayString(char *mess, BOOL flag) { // for debug file - char buf[MSG_SIZ], *p; + char buf[8000], *p; if(appData.debugMode) fprintf(debugFP, "SAY '%s'\n", mess); strcpy(buf, mess); if(p = StrCaseStr(buf, "Xboard adjudication:")) { @@ -229,7 +229,6 @@ AdaptMenu() helpMenuInfo.cbSize = sizeof(helpMenuInfo); menuMain = GetMenu(hwndMain); - if(appData.debugMode) fprintf(debugFP, "hwndMain: %8x %8x\n", hwndMain, menuMain); menuJAWS = CreatePopupMenu(); for(i=0; menuItemJAWS[i].name; i++) { @@ -353,7 +352,6 @@ KeyboardEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) return; } -extern char castlingRights[MAX_MOVES][BOARD_SIZE]; int PosFlags(int nr); typedef struct { @@ -432,8 +430,7 @@ PossibleAttackMove() swapColor = piece < (int)BlackPawn && !WhiteOnMove(currentMove) || piece >= (int)BlackPawn && WhiteOnMove(currentMove); cl.count = 0; cl.rf = fromY; cl.ff = fromX; cl.rt = cl.ft = -1; - GenLegal(boards[currentMove], PosFlags(currentMove + swapColor), EP_NONE, - castlingRights[currentMove], ReadCallback, (VOIDSTAR) &cl); + GenLegal(boards[currentMove], PosFlags(currentMove + swapColor), ReadCallback, (VOIDSTAR) &cl); if(cl.count == 0) SayString("None", FALSE); boards[currentMove][fromY][fromX] = victim; // repair @@ -460,16 +457,14 @@ PossibleAttacked() victim = boards[currentMove][fromY][fromX]; // put dummy piece on target square, to activate Pawn captures boards[currentMove][fromY][fromX] = WhiteOnMove(currentMove) ? WhiteQueen : BlackQueen; cl.count = 0; cl.rt = fromY; cl.ft = fromX; cl.rf = cl.ff = -1; - GenLegal(boards[currentMove], PosFlags(currentMove+1), EP_NONE, - castlingRights[currentMove], ReadCallback, (VOIDSTAR) &cl); + GenLegal(boards[currentMove], PosFlags(currentMove+1), ReadCallback, (VOIDSTAR) &cl); if(cl.count == 0) SayString("None", FALSE); SayString("You are defended by", FALSE); boards[currentMove][fromY][fromX] = WhiteOnMove(currentMove) ? BlackQueen : WhiteQueen; cl.count = 0; cl.rt = fromY; cl.ft = fromX; cl.rf = cl.ff = -1; - GenLegal(boards[currentMove], PosFlags(currentMove), EP_NONE, - castlingRights[currentMove], ReadCallback, (VOIDSTAR) &cl); + GenLegal(boards[currentMove], PosFlags(currentMove), ReadCallback, (VOIDSTAR) &cl); if(cl.count == 0) SayString("None", FALSE); boards[currentMove][fromY][fromX] = victim; // put back original occupant @@ -1123,9 +1118,10 @@ KeyboardMove(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) (BlackPawn <= pdown && pdown <= BlackKing && BlackPawn <= pup && pup <= BlackKing))) { /* EditPosition, empty square, or different color piece; - click-click move is possible */ + click-click move is possible */ + char promoChoice = NULLCHAR; - if (IsPromotion(oldFromX, oldFromY, fromX, fromY)) { + if (HasPromotionChoice(oldFromX, oldFromY, fromX, fromY, &promoChoice)) { if (appData.alwaysPromoteToQueen) { UserMoveEvent(oldFromX, oldFromY, fromX, fromY, 'q'); } @@ -1136,7 +1132,7 @@ KeyboardMove(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } } else { - UserMoveEvent(oldFromX, oldFromY, fromX, fromY, NULLCHAR); + UserMoveEvent(oldFromX, oldFromY, fromX, fromY, promoChoice); } oldFromX = oldFromY = -1; break; @@ -1184,11 +1180,11 @@ NiceTime(int x) } #define JAWS_ARGS \ - { "beepOffBoard", ArgInt, (LPVOID) beeps, TRUE },\ - { "beepEmpty", ArgInt, (LPVOID) (beeps+1), TRUE },\ - { "beepWhite", ArgInt, (LPVOID) (beeps+2), TRUE },\ - { "beepBlack", ArgInt, (LPVOID) (beeps+3), TRUE },\ - { "beepHoldings", ArgInt, (LPVOID) (beeps+4), TRUE },\ + { "beepOffBoard", ArgInt, (LPVOID) beeps, TRUE, (ArgIniType) 1 },\ + { "beepEmpty", ArgInt, (LPVOID) (beeps+1), TRUE, (ArgIniType) 0 },\ + { "beepWhite", ArgInt, (LPVOID) (beeps+2), TRUE, (ArgIniType) 0 },\ + { "beepBlack", ArgInt, (LPVOID) (beeps+3), TRUE, (ArgIniType) 0 },\ + { "beepHoldings", ArgInt, (LPVOID) (beeps+4), TRUE, (ArgIniType) 0 },\ #define JAWS_ALT_INTERCEPT \ if(suppressOneKey) {\