X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=40fb9ce5458e0df6f33160d7392a8b56aa0e1501;hb=f7f6d954bca7c593d7656edf24a2df177cb06869;hp=55866495eecda262707a77171410bd26fc4cc7b1;hpb=5c635c780111b73638ba3a160b347ede6e117357;p=xboard.git diff --git a/backend.c b/backend.c index 5586649..40fb9ce 100644 --- a/backend.c +++ b/backend.c @@ -1,11 +1,13 @@ /* * backend.c -- Common back end for X and Windows NT versions of - * XBoard $Id: backend.c,v 2.6 2003/11/28 09:37:36 mann Exp $ * * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. Enhancements Copyright - * 1992-2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software - * Foundation, Inc. + * Massachusetts. + * + * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, + * 2007, 2008, 2009 Free Software Foundation, Inc. + * + * Enhancements Copyright 2005 Alessandro Scotti * * The following terms apply to Digital Equipment Corporation's copyright * interest in XBoard: @@ -822,9 +824,8 @@ InitBackEnd1() #endif if (appData.noChessProgram) { - programVersion = (char*) malloc(5 + strlen(PRODUCT) + strlen(VERSION) - + strlen(PATCHLEVEL)); - sprintf(programVersion, "%s %s.%s", PRODUCT, VERSION, PATCHLEVEL); + programVersion = (char*) malloc(5 + strlen(PACKAGE_STRING)); + sprintf(programVersion, "%s", PACKAGE_STRING); } else { #if 0 char *p, *q; @@ -832,15 +833,13 @@ InitBackEnd1() while (*q != ' ' && *q != NULLCHAR) q++; p = q; while (p > first.program && *(p-1) != '/' && *(p-1) != '\\') p--; /* [HGM] backslash added */ - programVersion = (char*) malloc(8 + strlen(PRODUCT) + strlen(VERSION) - + strlen(PATCHLEVEL) + (q - p)); - sprintf(programVersion, "%s %s.%s + ", PRODUCT, VERSION, PATCHLEVEL); + programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING + (q - p)); + sprintf(programVersion, "%s + ", PACKAGE_STRING); strncat(programVersion, p, q - p); #else /* [HGM] tidy: use tidy name, in stead of full pathname (which was probably a bug due to / vs \ ) */ - programVersion = (char*) malloc(8 + strlen(PRODUCT) + strlen(VERSION) - + strlen(PATCHLEVEL) + strlen(first.tidy)); - sprintf(programVersion, "%s %s.%s + %s", PRODUCT, VERSION, PATCHLEVEL, first.tidy); + programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING) + strlen(first.tidy)); + sprintf(programVersion, "%s + %s", PACKAGE_STRING, first.tidy); #endif } @@ -3825,7 +3824,7 @@ ParseBoard12(string) #endif } - if (moveNum > 0 && !gotPremove) { + if (moveNum > 0 && !gotPremove && !appData.noGUI) { /* If move comes from a remote source, animate it. If it isn't remote, it will have already been animated. */ if (!pausing && !ics_user_moved && prevMove == moveNum - 1) { @@ -3855,7 +3854,7 @@ ParseBoard12(string) /* Display opponents and material strengths */ if (gameInfo.variant != VariantBughouse && - gameInfo.variant != VariantCrazyhouse) { + gameInfo.variant != VariantCrazyhouse && !appData.noGUI) { if (tinyLayout || smallLayout) { if(gameInfo.variant == VariantNormal) sprintf(str, "%s(%d) %s(%d) {%d %d}", @@ -3883,7 +3882,7 @@ ParseBoard12(string) /* Display the board */ - if (!pausing) { + if (!pausing && !appData.noGUI) { if (appData.premove) if (!gotPremove || @@ -5207,7 +5206,13 @@ if(appData.debugMode) fprintf(debugFP, "moveType 1 = %d, promochar = %x\n", move /* [HGM] convert drag-and-drop piece drops to standard form */ if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) { moveType = WhiteOnMove(currentMove) ? WhiteDrop : BlackDrop; - fromX = boards[currentMove][fromY][fromX]; + if(appData.debugMode) fprintf(debugFP, "Drop move %d, curr=%d, x=%d,y=%d, p=%d\n", + moveType, currentMove, fromX, fromY, boards[currentMove][fromY][fromX]); +// fromX = boards[currentMove][fromY][fromX]; + // holdings might not be sent yet in ICS play; we have to figure out which piece belongs here + if(fromX == 0) fromY = BOARD_HEIGHT-1 - fromY; // black holdings upside-down + fromX = fromX ? WhitePawn : BlackPawn; // first piece type in selected holdings + while(PieceToChar(fromX) == '.' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) fromX++; fromY = DROP_RANK; }