#include <sys/types.h>\r
#include <sys/stat.h>\r
#include <math.h>\r
+#include <ctype.h>\r
\r
#if STDC_HEADERS\r
# include <stdlib.h>\r
void InitBackEnd3 P((void));\r
void FeatureDone P((ChessProgramState* cps, int val));\r
void InitChessProgram P((ChessProgramState *cps, int setup));\r
+void OutputKibitz(int window, char *text);\r
+int PerpetualChase(int first, int last);\r
+int EngineOutputIsUp();\r
+void InitDrawingSizes(int x, int y);\r
\r
#ifdef WIN32\r
extern void ConsoleCreate();\r
extern int tinyLayout, smallLayout;\r
ChessProgramStats programStats;\r
static int exiting = 0; /* [HGM] moved to top */\r
-static int setboardSpoiledMachineBlack = 0, errorExitFlag = 0;\r
-extern int startedFromPositionFile;\r
+static int setboardSpoiledMachineBlack = 0 /*, errorExitFlag = 0*/;\r
int startedFromPositionFile = FALSE; Board filePosition; /* [HGM] loadPos */\r
char endingGame = 0; /* [HGM] crash: flag to prevent recursion of GameEnds() */\r
int whiteNPS, blackNPS; /* [HGM] nps: for easily making clocks aware of NPS */\r
return dst;\r
}\r
\r
+#if 0\r
+//[HGM] for future use? Conditioned out for now to suppress warning.\r
static char * safeStrCat( char * dst, const char * src, size_t count )\r
{\r
size_t dst_len;\r
\r
return dst;\r
}\r
+#endif\r
\r
/* Some compiler can't cast u64 to double\r
* This function do the job for us:\r
{\r
int newHoldingsWidth, newWidth = 8, newHeight = 8, i, j;\r
int oldCurrentMove = currentMove, oldForwardMostMove = forwardMostMove, oldBackwardMostMove = backwardMostMove;\r
- Board tempBoard; int saveCastling[BOARD_SIZE], saveEP;\r
+// Board tempBoard; int saveCastling[BOARD_SIZE], saveEP;\r
\r
startedFromPositionFile = FALSE;\r
if(gameInfo.variant == newVariant) return;\r
(StrStr(star_match[0], gameInfo.white) == star_match[0] || \r
StrStr(star_match[0], gameInfo.black) == star_match[0] )) { // kibitz of self or opponent\r
suppressKibitz = TRUE;\r
- if((StrStr(star_match[0], gameInfo.white) == star_match[0])\r
- && (gameMode == IcsPlayingWhite) ||\r
- (StrStr(star_match[0], gameInfo.black) == star_match[0])\r
- && (gameMode == IcsPlayingBlack) ) // opponent kibitz\r
+ if((StrStr(star_match[0], gameInfo.white) == star_match[0]\r
+ && (gameMode == IcsPlayingWhite)) ||\r
+ (StrStr(star_match[0], gameInfo.black) == star_match[0]\r
+ && (gameMode == IcsPlayingBlack)) ) // opponent kibitz\r
started = STARTED_CHATTER; // own kibitz we simply discard\r
else {\r
started = STARTED_COMMENT; // make sure it will be collected in parse[]\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
void\r
AlphaRank(char *move, int n)\r
{\r
- char *p = move, c; int x, y;\r
+// char *p = move, c; int x, y;\r
\r
if (appData.debugMode) {\r
fprintf(debugFP, "alphaRank(%s,%d)\n", move, n);\r
}\r
}\r
\r
+#if 0\r
/* [AS] FRC game initialization */\r
static int FindEmptySquare( Board board, int n )\r
{\r
return i;\r
}\r
\r
-#if 0\r
static void ShuffleFRC( Board board )\r
{\r
int i;\r
\r
int squaresLeft[4];\r
int piecesLeft[(int)BlackPawn];\r
-long long int seed, nrOfShuffles;\r
+u64 seed, nrOfShuffles;\r
\r
void GetPositionNumber()\r
{ // sets global variable seed\r
int i;\r
\r
for(i=BOARD_LEFT; i<BOARD_RGHT; i++) {\r
- if( ((i-BOARD_LEFT)&1)+1 & shade && board[rank][i] == EmptySquare && n-- == 0) {\r
+ if( (((i-BOARD_LEFT)&1)+1) & shade && board[rank][i] == EmptySquare && n-- == 0) {\r
board[rank][i] = (ChessSquare) pieceType;\r
- squaresLeft[(i-BOARD_LEFT&1) + 1]--;\r
+ squaresLeft[((i-BOARD_LEFT)&1) + 1]--;\r
squaresLeft[ANY]--;\r
piecesLeft[pieceType]--; \r
return i;\r
// in variants with super-numerary Kings and Rooks, we leave these for the shuffle\r
}\r
\r
- if((BOARD_RGHT-BOARD_LEFT & 1) == 0)\r
+ if(((BOARD_RGHT-BOARD_LEFT) & 1) == 0)\r
// only for even boards make effort to put pairs of colorbound pieces on opposite colors\r
for(p = (int) WhiteKing; p > (int) WhitePawn; p--) {\r
if(p != (int) WhiteBishop && p != (int) WhiteFerz && p != (int) WhiteAlfil) continue;\r
nrCastlingRights = 6;\r
castlingRights[0][0] = initialRights[0] = BOARD_RGHT-1;\r
castlingRights[0][1] = initialRights[1] = BOARD_LEFT;\r
- castlingRights[0][2] = initialRights[2] = BOARD_WIDTH-1>>1;\r
+ castlingRights[0][2] = initialRights[2] =(BOARD_WIDTH-1)>>1;\r
castlingRights[0][3] = initialRights[3] = BOARD_RGHT-1;\r
castlingRights[0][4] = initialRights[4] = BOARD_LEFT;\r
- castlingRights[0][5] = initialRights[5] = BOARD_WIDTH-1>>1;\r
+ castlingRights[0][5] = initialRights[5] =(BOARD_WIDTH-1)>>1;\r
break;\r
case VariantFalcon:\r
pieces = FalconArray;\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
\r
void SendProgramStatsToFrontend( ChessProgramState * cps, ChessProgramStats * cpstats )\r
{\r
- char * hint = lastHint;\r
+// char * hint = lastHint;\r
FrontEndProgramStats stats;\r
\r
stats.which = cps == &first ? 0 : 1;\r
sprintf(buf1, _("Illegal move \"%s\" from %s machine"),\r
machineMove, cps->which);\r
DisplayError(buf1, 0);\r
- sprintf(buf1, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c) res=%d%c",\r
- machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, 0);\r
+ sprintf(buf1, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c) res=%d",\r
+ machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, moveType);\r
if (gameMode == TwoMachinesPlay) {\r
GameEnds(machineWhite ? BlackWins : WhiteWins,\r
buf1, GE_XBOARD);\r
toX--;\r
currentMoveString[2]--;\r
break;\r
+ default: ; // nothing to do, but suppresses warning of pedantic compilers\r
}\r
}\r
hintRequested = FALSE;\r
programStats.depth,\r
programStats.score / 100.,\r
programStats.time / 100.,\r
- (double) programStats.nodes,\r
- programStats.nodes / (10*abs(programStats.time) + 1.),\r
+ u64ToDouble(programStats.nodes),\r
+ u64ToDouble(programStats.nodes) / (10*abs(programStats.time) + 1.),\r
programStats.movelist);\r
SendToICS(buf);\r
}\r
{ /* [HGM] Some more adjudications for obstinate engines */\r
int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,\r
NrWQ=0, NrBQ=0, NrW=0, bishopsColor = 0,\r
- NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;\r
+ NrPieces=0, NrPawns=0, PawnAdvance=0, i, j;\r
static int moveCount = 6;\r
\r
/* First absolutely insufficient mating material. Count what is on board. */\r
strcat(bookMove, bookHit);\r
message = bookMove;\r
cps = cps->other;\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
if(cps->nps >= 0) { /* [HGM] nps: use engine nodes or time to decrement clock */\r
int ticklen;\r
\r
- if(cps->nps == 0) ticklen = 10*time; // use engine reported time\r
- else ticklen = (1000. * nodes) / cps->nps; // convert node count to time\r
+ if(cps->nps == 0) ticklen = 10*time; // use engine reported time\r
+ else ticklen = (1000. * u64ToDouble(nodes)) / cps->nps; // convert node count to time\r
if(WhiteOnMove(forwardMostMove)) \r
whiteTimeRemaining = timeRemaining[0][forwardMostMove] - ticklen;\r
else blackTimeRemaining = timeRemaining[1][forwardMostMove] - ticklen;\r
else {\r
buf1[0] = NULLCHAR;\r
\r
- if (sscanf(message, "%d%c %d %d %lu %[^\n]\n",\r
+ if (sscanf(message, "%d%c %d %d " u64Display " %[^\n]\n",\r
&plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) \r
{\r
ChessProgramStats cpstats;\r
/* [HGM] compute & store e.p. status and castling rights for new position */\r
/* if we are updating a board for which those exist (i.e. in boards[]) */\r
if((p = ((int)board - (int)boards[0])/((int)boards[1]-(int)boards[0])) < MAX_MOVES && p > 0)\r
- { int i, j;\r
+ { int i;\r
\r
if(gameInfo.variant == VariantBerolina) berolina = EP_BEROLIN_A;\r
oldEP = epStatus[p-1];\r
{\r
int i, offset, linelen, newblock;\r
time_t tm;\r
- char *movetext;\r
+// char *movetext;\r
char numtext[32];\r
int movelen, numlen, blank;\r
char move_buffer[100]; /* [AS] Buffer for move+PV info */\r
#else\r
seconds = (pvInfoList[i].time + 5)/10; // [HGM] PVtime: use engine time\r
#endif\r
- if (appData.debugMode,0) {\r
- fprintf(debugFP, "times = %d %d %d %d, seconds=%d\n",\r
- timeRemaining[0][i+1], timeRemaining[0][i],\r
- timeRemaining[1][i+1], timeRemaining[1][i], seconds\r
- );\r
- }\r
\r
if( seconds <= 0) buf[0] = 0; else\r
if( seconds < 30 ) sprintf(buf, " %3.1f%c", seconds/10., 0); else {\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
if(bookHit) { // [HGM] book: simulate book reply\r
static char bookMove[MSG_SIZ]; // a bit generous?\r
\r
- programStats.depth = programStats.nodes = programStats.time = \r
+ programStats.nodes = programStats.depth = programStats.time = \r
programStats.score = programStats.got_only_move = 0;\r
sprintf(programStats.movelist, "%s (xbook)", bookHit);\r
\r
#else /*!HAVE_GETTIMEOFDAY*/\r
#if HAVE_FTIME\r
\r
-#include <sys/timeb.h>\r
+// include <sys/timeb.h> / moved to just above start of function\r
struct timeb timeB;\r
\r
ftime(&timeB);\r
} ChessProgramStats;\r
\r
extern ChessProgramStats_Move pvInfoList[MAX_MOVES];\r
-extern shuffleOpenings;\r
+extern int shuffleOpenings;\r
extern ChessProgramStats programStats;\r
\r
#endif /* _BACKEND */\r
#include <stdio.h>
#include <string.h>
+#include <time.h>
+#include <stdlib.h>
#include "common.h"
#include "backend.h"
uint64 hash(int moveNr)
{
- char c;
- int p, r, f, i, p_enc, squareNr, pieceGroup;
+ int r, f, p_enc, squareNr, pieceGroup;
uint64 key=0, Zobrist;
for(f=BOARD_LEFT; f<BOARD_RGHT; f++){
int WhitePiece P((ChessSquare));
int BlackPiece P((ChessSquare));
int SameColor P((ChessSquare, ChessSquare));
+int PosFlags(int index);
extern char initialRights[BOARD_SIZE]; /* [HGM] all rights enabled, set in InitPosition */
case SHOGI BlackKing:
case WhiteKing:
case BlackKing:
- walking:
+// walking:
for (i = -1; i <= 1; i++)
for (j = -1; j <= 1; j++) {
if (i == 0 && j == 0) continue;
int rf, ff, rt, ft;
VOIDSTAR closure;
{ // for determining if a piece (given through the closure) is protected
- register ChaseClosure *cl = (ChaseClosure *) closure; // closure tells us where to recapture
-
- if(rt == cl->rt && ft == cl->ft) cl->recaptures++; // count legal recaptures to this square
- if(appData.debugMode && board[rt][ft] != EmptySquare)
- fprintf(debugFP, "try %c%c%c%c=%d\n", ff+AAA, rf+ONE,ft+AAA, rt+ONE, cl->recaptures);
+ register ChaseClosure *cl = (ChaseClosure *) closure; // closure tells us where to recapture
+
+ if(rt == cl->rt && ft == cl->ft) cl->recaptures++; // count legal recaptures to this square
+ if(appData.debugMode && board[rt][ft] != EmptySquare)
+ fprintf(debugFP, "try %c%c%c%c=%d\n", ff+AAA, rf+ONE,ft+AAA, rt+ONE, cl->recaptures);
}
extern char moveList[MAX_MOVES][MOVE_LEN];
cl.recaptures = 0; // prepare closure to pass recapture square and count moves to it
cl.rt = chaseStack[j].rt;
cl.ft = chaseStack[j].ft;
- if(appData.debugMode) { int n;
+ if(appData.debugMode) {
fprintf(debugFP, "test if we can recapture %c%c\n", cl.ft+AAA, cl.rt+ONE);
}
GenLegal(boards[i+1], PosFlags(i+1), EP_NONE, initialRights, ProtectedCallback, &cl); // try all moves
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
-#include <errno.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifdef __cplusplus
#include <stdlib.h>
-#ifndef _WIN32
#include <unistd.h>
-#endif
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
#define YY_PROTO(proto) ()
#endif
-
/* Returned upon end-of-file. */
#define YY_NULL 0
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
}
-#ifndef _WIN32
-#include <unistd.h>
-#else
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif
-#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
locked = !((err == NO_ERROR) || (err == ERROR_NOT_LOCKED));\r
if (appData.debugMode) {\r
fprintf(debugFP, \r
- "CopyTextToClipboard(): err %d locked %d\n", err, locked);\r
+ "CopyTextToClipboard(): err %d locked %d\n", (int)err, locked);\r
}\r
}\r
if (locked) {\r
locked = !((err == NO_ERROR) || (err == ERROR_NOT_LOCKED));\r
if (appData.debugMode) {\r
fprintf(debugFP, \r
- "PasteTextFromClipboard(): err %d locked %d\n", err, locked);\r
+ "PasteTextFromClipboard(): err %d locked %d\n", (int)err, locked);\r
}\r
}\r
if (locked) \r
#include "winboard.h"\r
#include "frontend.h"\r
#include "backend.h"\r
+#include "wedittags.h"\r
\r
/* Module globals */\r
static char *editTagsText;\r
int an_move_count;\r
} EngineOutputData;\r
\r
-static VerifyDisplayMode();\r
+static void VerifyDisplayMode();\r
static void UpdateControls( EngineOutputData * ed );\r
-static SetEngineState( int which, int state, char * state_data );\r
+static void SetEngineState( int which, int state, char * state_data );\r
\r
// front end\r
static HICON LoadIconEx( int id )\r
{\r
RECT rc;\r
int headerHeight = GetHeaderHeight();\r
- int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
- int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN;\r
- int labelDeltaY = ICON_SIZE - labelHeight;\r
+// int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
+// int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN;\r
+// int labelDeltaY = ICON_SIZE - labelHeight;\r
int clientWidth;\r
int clientHeight;\r
int maxControlWidth;\r
\r
\r
// back end, due to front-end wrapper for SetWindowText, and new SetIcon arguments\r
-static SetEngineState( int which, int state, char * state_data )\r
+static void SetEngineState( int which, int state, char * state_data )\r
{\r
int x_which = 1 - which;\r
\r
result = cps->twoMachinesColor[0];\r
result = result == 'w' ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
break;\r
+ default: ; // does not happen, but suppresses pedantic warnings\r
}\r
}\r
\r
if( GetEngineColor( which ) != GetActiveEngineColor() ) result = TRUE;\r
}\r
break;\r
+ default: ; // does not happen, but suppresses pedantic warnings\r
}\r
\r
return result;\r
}\r
\r
// pure back end\r
-static VerifyDisplayMode()\r
+static void VerifyDisplayMode()\r
{\r
int mode;\r
\r
// pure back end, now SetWindowText is called via wrapper DoSetWindowText\r
static void UpdateControls( EngineOutputData * ed )\r
{\r
- int isPondering = FALSE;\r
+// int isPondering = FALSE;\r
\r
char s_label[MAX_NAME_LENGTH + 32];\r
\r
SetEngineState( ed->which, STATE_THINKING, "" );\r
}\r
else if( gameMode == AnalyzeMode || gameMode == AnalyzeFile\r
- || gameMode == IcsObserving && appData.icsEngineAnalyze) { // [HGM] ICS-analyze\r
+ || (gameMode == IcsObserving && appData.icsEngineAnalyze)) { // [HGM] ICS-analyze\r
char buf[64];\r
int time_secs = ed->time / 100;\r
int time_mins = time_secs / 60;\r
sprintf(b, "%d", value);\r
\r
cbBuf = strlen( buf );\r
-\r
GetTextExtentPoint32( hdcPB, buf, cbBuf, &stSize );\r
-\r
TextOut( hdcPB, MarginX - stSize.cx - 2, y - stSize.cy / 2, buf, cbBuf );\r
}\r
}\r
#include "backend.h"\r
\r
#include "wsnap.h"\r
+#include "wgamelist.h"\r
\r
/* Module globals */\r
HWND gameListDialog = NULL;\r
#include <dlgs.h>\r
#include <richedit.h>\r
#include <mmsystem.h>\r
+#include <ctype.h>\r
\r
#if __GNUC__\r
#include <errno.h>\r
Boolean flipClock = FALSE;\r
\r
void DisplayHoldingsCount(HDC hdc, int x, int y, int align, int copyNumber);\r
+VOID NewVariantPopup(HWND hwnd);\r
+int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY,\r
+ /*char*/int promoChar));\r
\r
typedef struct {\r
ChessSquare piece; \r
static HBITMAP pieceBitmap[3][(int) BlackPawn]; /* [HGM] nr of bitmaps referred to bP in stead of wK */\r
static HBRUSH lightSquareBrush, darkSquareBrush,\r
blackSquareBrush, /* [HGM] for band between board and holdings */\r
- whitePieceBrush, blackPieceBrush, iconBkgndBrush, outlineBrush;\r
+ whitePieceBrush, blackPieceBrush, iconBkgndBrush /*, outlineBrush*/;\r
static POINT gridEndpoints[(BOARD_SIZE + 1) * 4];\r
static DWORD gridVertexCounts[(BOARD_SIZE + 1) * 2];\r
static HPEN gridPen = NULL;\r
{ NULL, 0, 0, 0, 0, 0, 0 }\r
};\r
\r
-#define MF(x) {x, {0, }, {0, }, 0}\r
+#define MF(x) {x, {{0,}, 0. }, {0, }, 0}\r
MyFont fontRec[NUM_SIZES][NUM_FONTS] =\r
{\r
{ MF(CLOCK_FONT_TINY), MF(MESSAGE_FONT_TINY), MF(COORD_FONT_TINY), MF(CONSOLE_FONT_TINY), MF(COMMENT_FONT_TINY), MF(EDITTAGS_FONT_TINY), MF(MOVEHISTORY_FONT_ALL) },\r
{\r
MSG msg;\r
HANDLE hAccelMain, hAccelNoAlt, hAccelNoICS;\r
+// INITCOMMONCONTROLSEX ex;\r
\r
debugFP = stderr;\r
\r
if (!InitInstance(hInstance, nCmdShow, lpCmdLine)) {\r
return (FALSE);\r
}\r
+// InitCommonControlsEx(&ex);\r
+ InitCommonControls();\r
\r
hAccelMain = LoadAccelerators (hInstance, szAppName);\r
hAccelNoAlt = LoadAccelerators (hInstance, "NO_ALT");\r
FILE* f = (FILE*) getClosure;\r
\r
c = getc(f);\r
+ if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely\r
if (c == EOF)\r
return NULLCHAR;\r
else\r
dcb.fNull = FALSE;\r
dcb.fRtsControl = RTS_CONTROL_ENABLE;\r
dcb.fAbortOnError = FALSE;\r
- /* Microsoft SDK >= Feb. 2003 (MS VS >= 2002) */\r
- #if (defined(_MSC_VER) && _MSC_VER <= 1200) \r
- //dcb.wReserved = 0;\r
- #else\r
- dcb.wReserved = 0;\r
- #endif\r
dcb.ByteSize = 7;\r
dcb.Parity = SPACEPARITY;\r
dcb.StopBits = ONESTOPBIT;\r
case ArgColor:\r
{\r
COLORREF color = *(COLORREF *)ad->argLoc;\r
- fprintf(f, "/%s=#%02x%02x%02x\n", ad->argName, \r
+ fprintf(f, "/%s=#%02lx%02lx%02lx\n", ad->argName, \r
color&0xff, (color>>8)&0xff, (color>>16)&0xff);\r
}\r
break;\r
case ArgAttribs:\r
{\r
MyTextAttribs* ta = &textAttribs[(ColorClass)ad->argLoc];\r
- fprintf(f, "/%s=\"%s%s%s%s%s#%02x%02x%02x\"\n", ad->argName,\r
+ fprintf(f, "/%s=\"%s%s%s%s%s#%02lx%02lx%02lx\"\n", ad->argName,\r
(ta->effects & CFE_BOLD) ? "b" : "",\r
(ta->effects & CFE_ITALIC) ? "i" : "",\r
(ta->effects & CFE_UNDERLINE) ? "u" : "",\r
break;\r
case ArgCommSettings:\r
PrintCommSettings(f, ad->argName, (DCB *)ad->argLoc);\r
+ case ArgNone:\r
+ case ArgSettingsFilename: ;\r
}\r
}\r
fclose(f);\r
boardRect.top + lineGap / 2 + (i * (squareSize + lineGap));\r
gridEndpoints[i*2 + 1].x = boardRect.left + lineGap / 2 +\r
BOARD_WIDTH * (squareSize + lineGap);\r
- lineGap / 2 + (i * (squareSize + lineGap));\r
gridVertexCounts[i*2] = gridVertexCounts[i*2 + 1] = 2;\r
}\r
for (i = 0; i < BOARD_WIDTH + 1; i++) {\r
} else {\r
tmpSize = squareSize;\r
if(minorSize &&\r
- (piece >= (int)WhiteNightrider && piece <= WhiteGrasshopper ||\r
- piece >= (int)BlackNightrider && piece <= BlackGrasshopper) ) {\r
+ ((piece >= (int)WhiteNightrider && piece <= WhiteGrasshopper) ||\r
+ (piece >= (int)BlackNightrider && piece <= BlackGrasshopper)) ) {\r
/* [HGM] no bitmap available for promoted pieces in Crazyhouse */\r
/* Bitmaps of smaller size are substituted, but we have to align them */\r
x += (squareSize - minorSize)>>1;\r
VOID\r
DrawLogoOnDC(HDC hdc, RECT logoRect, ChessProgramState *cps)\r
{\r
- HBITMAP bufferBitmap;\r
+// HBITMAP bufferBitmap;\r
BITMAP bi;\r
- RECT Rect;\r
+// RECT Rect;\r
HDC tmphdc;\r
HBITMAP hbm;\r
int w = 100, h = 50;\r
boardRect.bottom - boardRect.top,\r
tmphdc, boardRect.left, boardRect.top, SRCCOPY);\r
if(saveDiagFlag) { \r
- BITMAP b; int i, j, m, w, wb, fac=0; char pData[1000000]; \r
+ BITMAP b; int i, j=0, m, w, wb, fac=0; char pData[1000000]; \r
BITMAPINFOHEADER bih; int color[16], nrColors=0;\r
\r
GetObject(bufferBitmap, sizeof(b), &b);\r
while(p&3) pData[p++] = 0;\r
}\r
fac = 3;\r
- wb = (wb+31>>5)<<2;\r
+ wb = ((wb+31)>>5)<<2;\r
}\r
// write BITMAPFILEHEADER\r
fprintf(diagFile, "BM");\r
SaveDiagram(f)\r
FILE *f;\r
{\r
- time_t tm;\r
- char *fen;\r
-\r
saveDiagFlag = 1; diagFile = f;\r
HDCDrawPosition(NULL, TRUE, NULL);\r
\r
PAINTSTRUCT ps;\r
HFONT oldFont;\r
\r
- if(hdc = BeginPaint(hwnd, &ps)) {\r
+ if((hdc = BeginPaint(hwnd, &ps))) {\r
if (IsIconic(hwnd)) {\r
DrawIcon(hdc, 2, 2, iconCurrent);\r
} else {\r
POINT pt;\r
static int recursive = 0;\r
HMENU hmenu;\r
- BOOLEAN needsRedraw = FALSE;\r
+// BOOLEAN needsRedraw = FALSE;\r
BOOLEAN saveAnimate;\r
BOOLEAN forceFullRepaint = IsFullRepaintPreferrable(); /* [AS] */\r
static BOOLEAN sameAgain = FALSE, promotionChoice = FALSE;\r
}\r
if (!appData.highlightLastMove) {\r
ClearHighlights();\r
- DrawPosition(forceFullRepaint || FALSE, NULL);\r
+ DrawPosition((int) (forceFullRepaint || FALSE), NULL);\r
}\r
fromX = fromY = -1;\r
dragInfo.start.x = dragInfo.start.y = -1;\r
} else if (x < 0 || y < 0\r
/* [HGM] block clicks between board and holdings */\r
|| x == BOARD_LEFT-1 || x == BOARD_RGHT\r
- || x == BOARD_LEFT-2 && y < BOARD_HEIGHT-gameInfo.holdingsSize\r
- || x == BOARD_RGHT+1 && y >= gameInfo.holdingsSize\r
+ || (x == BOARD_LEFT-2 && y < BOARD_HEIGHT-gameInfo.holdingsSize)\r
+ || (x == BOARD_RGHT+1 && y >= gameInfo.holdingsSize)\r
/* EditPosition, empty square, or different color piece;\r
click-click move is possible */\r
) {\r
if(moveType != ImpossibleMove) {\r
/* [HGM] We use PromotionToKnight in Shogi to indicate frorced promotion */\r
if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight ||\r
- (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) &&\r
- appData.alwaysPromoteToQueen) {\r
+ ((moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) &&\r
+ appData.alwaysPromoteToQueen)) {\r
FinishMove(moveType, fromX, fromY, toX, toY, 'q');\r
if (!appData.highlightLastMove) {\r
ClearHighlights();\r
/* [HGM] use move type to determine if move is promotion.\r
Knight is Shogi kludge for mandatory promotion, Queen means choice */\r
if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight ||\r
- (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) &&\r
- appData.alwaysPromoteToQueen) \r
+ ((moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) &&\r
+ appData.alwaysPromoteToQueen)) \r
FinishMove(moveType, fromX, fromY, toX, toY, 'q');\r
else \r
if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) {\r
* Play moves forward\r
*/\r
if((short)HIWORD(wParam) > 0 && currentMove < forwardMostMove) \r
- if(lastDir == 1) ForwardEvent(); else lastDir = 1; // [HGM] suppress first event in each direction\r
+ { if(lastDir == 1) ForwardEvent(); else lastDir = 1; } // [HGM] suppress first event in direction\r
/* Mouse Wheel is being rolled backward\r
* Play moves backward\r
*/\r
if((short)HIWORD(wParam) < 0 && currentMove > backwardMostMove) \r
- if(lastDir == -1) BackwardEvent(); else lastDir = -1;\r
+ { if(lastDir == -1) BackwardEvent(); else lastDir = -1; }\r
}\r
break;\r
\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Only allow C & A promotions if these pieces are defined */\r
ShowWindow(GetDlgItem(hDlg, PB_Archbishop),\r
- (PieceToChar(WhiteAngel) >= 'A' &&\r
- PieceToChar(WhiteAngel) != '~' ||\r
- PieceToChar(BlackAngel) >= 'A' &&\r
- PieceToChar(BlackAngel) != '~' ) ?\r
+ ((PieceToChar(WhiteAngel) >= 'A' &&\r
+ PieceToChar(WhiteAngel) != '~') ||\r
+ (PieceToChar(BlackAngel) >= 'A' &&\r
+ PieceToChar(BlackAngel) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
ShowWindow(GetDlgItem(hDlg, PB_Chancellor), \r
- (PieceToChar(WhiteMarshall) >= 'A' &&\r
- PieceToChar(WhiteMarshall) != '~' ||\r
- PieceToChar(BlackMarshall) >= 'A' &&\r
- PieceToChar(BlackMarshall) != '~' ) ?\r
+ ((PieceToChar(WhiteMarshall) >= 'A' &&\r
+ PieceToChar(WhiteMarshall) != '~') ||\r
+ (PieceToChar(BlackMarshall) >= 'A' &&\r
+ PieceToChar(BlackMarshall) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Hide B & R button in Shogi, use Q as promote, N as defer */\r
ShowWindow(GetDlgItem(hDlg, PB_Rook),\r
{\r
EnableWindow(GetDlgItem(hDlg, OPT_ChessEngineName),\r
IsDlgButtonChecked(hDlg, OPT_ChessEngine) ||\r
- appData.zippyPlay && IsDlgButtonChecked(hDlg, OPT_ChessServer));\r
+ (appData.zippyPlay && IsDlgButtonChecked(hDlg, OPT_ChessServer)));\r
EnableWindow(GetDlgItem(hDlg, OPT_SecondChessEngineName),\r
IsDlgButtonChecked(hDlg, OPT_ChessEngine));\r
EnableWindow(GetDlgItem(hDlg, OPT_ChessServerName),\r
GothicPopUp(char *title, VariantClass variant)\r
{\r
FARPROC lpProc;\r
- char *p, *q;\r
- BOOLEAN modal = hwndMain == NULL;\r
static char *lastTitle;\r
\r
strncpy(errorTitle, title, sizeof(errorTitle));\r
void\r
ParseIcsTextMenu(char *icsTextMenuString)\r
{\r
- int flags = 0;\r
+// int flags = 0;\r
IcsTextMenuEntry *e = icsTextMenuEntry;\r
char *p = icsTextMenuString;\r
while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {\r
ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
static SnapData sd;\r
- static HWND hText, hInput, hFocus;\r
- InputSource *is = consoleInputSource;\r
+ static HWND hText, hInput /*, hFocus*/;\r
+// InputSource *is = consoleInputSource;\r
RECT rect;\r
static int sizeX, sizeY;\r
int newSizeX, newSizeY;\r
\r
if( p >= is->next ) {\r
if (appData.debugMode) {\r
- fprintf( debugFP, "Input line exceeded buffer size (source id=%u)\n", is->id );\r
+ fprintf( debugFP, "Input line exceeded buffer size (source id=%lu)\n", is->id );\r
}\r
\r
is->error = ERROR_BROKEN_PIPE; /* [AS] Just any non-successful code! */\r
CloseHandle(is->hFile);\r
\r
if (appData.debugMode) {\r
- fprintf( debugFP, "Input thread terminated (id=%u, error=%d, count=%d)\n", is->id, is->error, is->count );\r
+ fprintf( debugFP, "Input thread terminated (id=%lu, error=%d, count=%ld)\n", is->id, is->error, is->count );\r
}\r
\r
return 0;\r
{\r
char * pc = lpUserGLT;\r
int idx = 0;\r
- int cnt = (int) SendDlgItemMessage( hDlg, IDC_GameListTags, LB_GETCOUNT, 0, 0 );\r
+// int cnt = (int) SendDlgItemMessage( hDlg, IDC_GameListTags, LB_GETCOUNT, 0, 0 );\r
char id;\r
\r
do {\r
result = TerminateProcess( cp->hProcess, 0 );\r
\r
if ( appData.debugMode) {\r
- fprintf( debugFP, "Terminating process %u, result=%d\n", cp->pid, result );\r
+ fprintf( debugFP, "Terminating process %lu, result=%d\n", cp->pid, result );\r
}\r
}\r
else if( signal == 10 ) {\r
result = TerminateProcess( cp->hProcess, 0 );\r
\r
if ( appData.debugMode) {\r
- fprintf( debugFP, "Process %u still alive after timeout, killing... result=%d\n", cp->pid, result );\r
+ fprintf( debugFP, "Process %lu still alive after timeout, killing... result=%d\n", cp->pid, result );\r
}\r
\r
}\r
\r
EngineOutputUpdate( stats );\r
}\r
-///
\ No newline at end of file
// Dialog\r
//\r
\r
-ABOUTBOX DIALOG DISCARDABLE 22, 17, 180, 108\r
+ABOUTBOX DIALOG DISCARDABLE 22, 17, 180, 88\r
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
CAPTION "About WinBoard"\r
FONT 8, "MS Sans Serif"\r
BEGIN\r
- DEFPUSHBUTTON "OK",IDOK,126,89,50,14,WS_GROUP\r
+ DEFPUSHBUTTON "OK",IDOK,126,69,50,14,WS_GROUP\r
ICON "icon_white",IDC_STATIC,3,6,20,20\r
LTEXT "Chessboard for Windows",400,25,15,121,8\r
LTEXT "Copyright 1991 Digital Equipment Corporation",201,6,34,\r
LTEXT "WinBoard 0.0.0",ABOUTBOX_Version,25,5,61,8\r
LTEXT "Enhancements Copyright 2005\r\nAlessandro Scotti",\r
IDC_STATIC,6,65,120,24\r
- LTEXT "Enhancements Copyright 2007\r\nH.G. Muller",\r
- IDC_STATIC,6,85,120,24\r
- LTEXT "(""WinBoard_F"")",IDC_STATIC,88,4,71,8\r
END\r
\r
DLG_TimeControl DIALOG DISCARDABLE 6, 18, 174, 134\r
#include <stdio.h>
#include <stdlib.h>
#include <shlobj.h> /* [AS] Requires NT 4.0 or Win95 */
+#include <ctype.h>
#include "common.h"
#include "winboard.h"
extern HWND hCommPort; /* currently open comm port */
extern DCB dcb;
extern BOOLEAN chessProgram;
-extern startedFromPositionFile; /* [HGM] loadPos */
+extern int startedFromPositionFile; /* [HGM] loadPos */
/* types */
VOID SetLoadOptionEnables(HWND hDlg);
VOID SetSaveOptionEnables(HWND hDlg);
VOID SetTimeControlEnables(HWND hDlg);
+void NewSettingEvent(int option, char *command, int value);
/*---------------------------------------------------------------------------*\
*
HBRUSH brushSquareOutline;
HBRUSH brushPiece;
HBRUSH brushPieceDetail;
- HBRUSH oldBrushPiece;
+ HBRUSH oldBrushPiece = NULL;
HBRUSH oldBrushSquare;
HBITMAP oldBitmapMem;
HBITMAP oldBitmapTemp;
break;
case SizeTitanic:
CheckDlgButton(hDlg, OPT_SizeTitanic, TRUE);
+ default: ; // should not happen, but suppresses warning on pedantic compilers
}
if (appData.monoMode)
LRESULT CALLBACK
NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- static Boolean mono;
static VariantClass v;
- static COLORREF lsc, dsc, wpc, bpc, hsc, phc;
- static HBITMAP pieces[3];
static int n1_ok, n2_ok, n3_ok;
switch (message) {
case VariantNoCastle:
CheckDlgButton(hDlg, OPT_VariantNocastle, TRUE);
break;
+// case VariantGreat: // Note to self: must still make this button (and GiveAway too).
+// CheckDlgButton(hDlg, OPT_VariantGreat, TRUE);
+// break;
+ default: ;
}
SetDlgItemInt( hDlg, IDC_Files, -1, TRUE );
err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) scd->label);
if (err != cnt++) {
sprintf(buf, "InitSoundCombo(): err '%d', cnt '%d'\n",
- err, cnt);
+ (int)err, (int)cnt);
MessageBox(NULL, buf, NULL, MB_OK);
}
scd++;
flow = cdFlow[FLOW_NONE].label;
}
fprintf(f, "/%s=%d,%d,%s,%s,%s\n", name,
- dcb->BaudRate, dcb->ByteSize, parity, stopBits, flow);
+ (int)dcb->BaudRate, dcb->ByteSize, parity, stopBits, flow);
}
hwndCombo = GetDlgItem(hDlg, OPT_DataRate);
InitCombo(hwndCombo, cdDataRate);
- sprintf(buf, "%u", dcb.BaudRate);
+ sprintf(buf, "%u", (int)dcb.BaudRate);
if (SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM) -1, (LPARAM) buf) == CB_ERR) {
SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);
SendMessage(hwndCombo, WM_SETTEXT, (WPARAM) 0, (LPARAM) buf);
boardX == BOARD_LEFT-2 && PieceForSquare(boardX+1, boardY) > 1)
XCopyArea(xDisplay, xBoardWindow, player.saveBuf, player.blitGC,
corner.x, corner.y, squareSize, squareSize,
- 0, 0); // [HGM] xh: unstack in stead of grab
+ 0, 0); // [HGM] zh: unstack in stead of grab
damage[boardY][boardX] = True;
} else {
player.dragActive = False;
#include "backendz.h"\r
\r
char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book\r
+void HandleMachineMove P((char *message, ChessProgramState *cps));\r
\r
static char zippyPartner[MSG_SIZ];\r
static char zippyLastOpp[MSG_SIZ];\r
return;\r
}\r
if (StrStr(appData.zippyVariants, varname) == NULL ||\r
- (i=first.protocolVersion) != 1 && StrStr(first.variants, varname) == NULL /* [HGM] zippyvar */\r
+ ((i=first.protocolVersion) != 1 && StrStr(first.variants, varname) == NULL) /* [HGM] zippyvar */\r
) {\r
sprintf(buf,\r
"%stell %s This computer can't play %s [%s], only %s\n%sdecline %s\n",\r