From: Arun Persaud Date: Fri, 17 Oct 2014 06:14:42 +0000 (-0700) Subject: Merge branch 'master' into v4.8.x X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=466523292d4a72a772dd4baf4ac5cd939f818888;hp=3ef533ab09a91b4372e87b0ba8ad80bb053bbcff;p=xboard.git Merge branch 'master' into v4.8.x --- diff --git a/backend.c b/backend.c index eb9059f..bab4386 100644 --- a/backend.c +++ b/backend.c @@ -8908,6 +8908,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h /* For variants we don't have */ && gameInfo.variant != VariantBerolina /* correct rules for, we cannot */ && gameInfo.variant != VariantCylinder /* enforce legality on our own! */ && gameInfo.variant != VariantUnknown + && gameInfo.variant != VariantGreat && gameInfo.variant != VariantFairy ) return; if(piece < EmptySquare) { pieceDefs = TRUE; @@ -12876,6 +12877,8 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) return FALSE; } CopyBoard(boards[0], initial_position); + if(*engineVariant) // [HGM] for now, assume FEN in engine-defined variant game is default initial position + CopyBoard(initialPosition, initial_position); if (blackPlaysFirst) { currentMove = forwardMostMove = backwardMostMove = 1; CopyBoard(boards[1], initial_position); @@ -17870,7 +17873,7 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) q = (boards[move][CASTLING][1] == BOARD_LEFT && boards[move][CASTLING][2] != NoRights ); if(handW) { // for S-Chess with pieces in hand, list virgin pieces between K and Q - for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q && j; i--) + for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q; i--) if((boards[move][0][i] != WhiteKing || k+q == 0) && boards[move][VIRGIN][i] & VIRGIN_W) *p++ = i + AAA + 'A' - 'a'; } @@ -17881,7 +17884,7 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) q = (boards[move][CASTLING][4] == BOARD_LEFT && boards[move][CASTLING][5] != NoRights ); if(handB) { - for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q && j; i--) + for(i=BOARD_RGHT-1-k; i>=BOARD_LEFT+q; i--) if((boards[move][BOARD_HEIGHT-1][i] != BlackKing || k+q == 0) && boards[move][VIRGIN][i] & VIRGIN_B) *p++ = i + AAA; } diff --git a/moves.c b/moves.c index aca97b5..4279ce9 100644 --- a/moves.c +++ b/moves.c @@ -268,7 +268,7 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle int mine, his, dir, bit, occup, i; if(flags & F_WHITE_ON_MOVE) his = 2, mine = 1; else his = 1, mine = 2; while(*p) { // more moves to go - int expo = 1, dx, dy, x, y, mode, dirSet, ds2, retry=0, initial=0, jump=1, skip = 0, all = 0; + int expo = 1, dx, dy, x, y, mode, dirSet, ds2=0, retry=0, initial=0, jump=1, skip = 0, all = 0; char *cont = NULL; if(*p == 'i') initial = 1, desc = ++p; while(islower(*p)) p++; // skip prefixes diff --git a/pgntags.c b/pgntags.c index f13eb96..fd74df7 100644 --- a/pgntags.c +++ b/pgntags.c @@ -115,10 +115,12 @@ ParsePGNTag (char *tag, GameInfo *gameInfo) } else if (StrCaseCmp(name, "Variant") == 0) { /* xboard-defined extension */ success = StrSavePtr(value, &gameInfo->variantName) != NULL; - gameInfo->variant = StringToVariant(value); + if(*value && strcmp(value, engineVariant)) // keep current engine-defined variant if it matches + gameInfo->variant = StringToVariant(value); } else if (StrCaseCmp(name, "VariantMen") == 0) { /* for now ignore this tag, as we have no method yet */ /* for assigning the pieces to XBoard pictograms */ + success = TRUE; } else if (StrCaseCmp(name, PGN_OUT_OF_BOOK) == 0) { /* [AS] Out of book annotation */ success = StrSavePtr(value, &gameInfo->outOfBook) != NULL; diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index feda2ca..e31f184 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -48,16 +48,8 @@ static BOOLEAN gameListUp = FALSE; static FILE* gameFile; static char* gameFileName = NULL; -struct GameListStats -{ - int white_wins; - int black_wins; - int drawn; - int unfinished; -}; - /* [AS] Setup the game list according to the specified filter */ -static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ) +int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ) { ListGame * lg = (ListGame *) gameList.head; int nItem; @@ -66,6 +58,9 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct int count = 0; struct GameListStats dummy; + if(!hDlg) hDlg = gameListDialog; // [HGM] to allow calling from Game List Options dialog + if(!hDlg) return 0; + /* Initialize stats (use a dummy variable if caller not interested in them) */ if( stats == NULL ) { stats = &dummy; diff --git a/winboard/winboard.c b/winboard/winboard.c index d0eb772..794ae49 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -8712,8 +8712,11 @@ int GameListOptions() result = DialogBoxParam( hInst, MAKEINTRESOURCE(DLG_GameListOptions), hwndMain, (DLGPROC)lpProc, (LPARAM)lpUserGLT ); if( result == 0 ) { + char *oldTags = appData.gameListTags; /* [AS] Memory leak here! */ appData.gameListTags = strdup( lpUserGLT ); + if(strcmp(oldTags, appData.gameListTags)) // [HGM] redo Game List when we changed something + GameListToListBox(NULL, TRUE, ".", NULL, FALSE, FALSE); // "." as filter is kludge to select all } return result; @@ -9776,6 +9779,7 @@ OutputToProcess(ProcRef pr, char *message, int count, int *outError) int outCount = SOCKET_ERROR; ChildProc *cp = (ChildProc *) pr; static OVERLAPPED ovl; + static int line = 0; if (pr == NoProc) diff --git a/winboard/winboard.h b/winboard/winboard.h index 0998c97..00caa95 100644 --- a/winboard/winboard.h +++ b/winboard/winboard.h @@ -211,6 +211,15 @@ extern HWND evalGraphDialog; extern HWND engineOutputDialog; +struct GameListStats +{ + int white_wins; + int black_wins; + int drawn; + int unfinished; +}; + +int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct GameListStats * stats, BOOL byPos, BOOL narrow ); VOID ShowGameListProc(void); extern HWND gameListDialog;