{ "localLineEditing", "localLineEditing", XtRBoolean,
sizeof(Boolean), XtOffset(AppDataPtr, localLineEditing),
XtRImmediate, (XtPointer) True }, /* not implemented, must be True */
-#ifdef ZIPPY
+#if ZIPPY
{ "zippyTalk", "zippyTalk", XtRBoolean,
sizeof(Boolean), XtOffset(AppDataPtr, zippyTalk),
XtRImmediate, (XtPointer) ZIPPY_TALK },
{ "adjudicateLossThreshold", "adjudicateLossThreshold", XtRInt,
sizeof(int), XtOffset(AppDataPtr, adjudicateLossThreshold),
XtRImmediate, (XtPointer) 0},
+ { "adjudicateDrawMoves", "adjudicateDrawMoves", XtRInt,
+ sizeof(int), XtOffset(AppDataPtr, adjudicateDrawMoves),
+ XtRImmediate, (XtPointer) 0},
{ "pgnEventHeader", "pgnEventHeader", XtRString,
sizeof(String), XtOffset(AppDataPtr, pgnEventHeader),
XtRImmediate, (XtPointer) "Computer Chess Game" },
XtRImmediate, (XtPointer) "xboard.debug"},
{ "engineDebugOutput", "engineDebugOutput", XtRInt,
sizeof(int), XtOffset(AppDataPtr, engineComments),
- XtRImmediate, (XtPointer) 0},
+ XtRImmediate, (XtPointer) 1},
{ "noGUI", "noGUI", XtRBoolean,
sizeof(Boolean), XtOffset(AppDataPtr, noGUI),
XtRImmediate, (XtPointer) 0},
{ "delayAfterQuit", "delayAfterQuit", XtRInt,
sizeof(int), XtOffset(AppDataPtr, delayAfterQuit),
XtRImmediate, (XtPointer) 0},
+ { "keepAlive", "keepAlive", XtRInt,
+ sizeof(int), XtOffset(AppDataPtr, keepAlive),
+ XtRImmediate, (XtPointer) 0},
+ { "forceIllegalMoves", "forceIllegalMoves", XtRBoolean,
+ sizeof(Boolean), XtOffset(AppDataPtr, forceIllegal),
+ XtRImmediate, (XtPointer) False},
};
XrmOptionDescRec shellOptions[] = {
{ "-pgnExtendedInfo", "pgnExtendedInfo", XrmoptionSepArg, NULL },
{ "-hideThinkingFromHuman", "hideThinkingFromHuman", XrmoptionSepArg, NULL },
{ "-adjudicateLossThreshold", "adjudicateLossThreshold", XrmoptionSepArg, NULL },
+ { "-adjudicateDrawMoves", "adjudicateDrawMoves", XrmoptionSepArg, NULL },
{ "-pgnEventHeader", "pgnEventHeader", XrmoptionSepArg, NULL },
{ "-firstIsUCI", "firstIsUCI", XrmoptionSepArg, NULL },
{ "-secondIsUCI", "secondIsUCI", XrmoptionSepArg, NULL },
{ "-secondOptions", "secondOptions", XrmoptionSepArg, NULL },
{ "-firstNeedsNoncompliantFEN", "firstNeedsNoncompliantFEN", XrmoptionSepArg, NULL },
{ "-secondNeedsNoncompliantFEN", "secondNeedsNoncompliantFEN", XrmoptionSepArg, NULL },
+ { "-keepAlive", "keepAlive", XrmoptionSepArg, NULL },
+ { "-forceIllegalMoves", "forceIllegalMoves", XrmoptionNoArg, "True" },
};
}
#ifdef GOTHIC
if(gameInfo.variant == VariantGothic) {
- ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[i][(int)WhiteSilver];
+ ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[(int)WhiteSilver];
}
#endif
#endif
}
#endif
+void EscapeExpand(char *p, char *q)
+{ // [HGM] initstring: routine to shape up string arguments
+ while(*p++ = *q++) if(p[-1] == '\\')
+ switch(*q++) {
+ case 'n': p[-1] = '\n'; break;
+ case 'r': p[-1] = '\r'; break;
+ case 't': p[-1] = '\t'; break;
+ case '\\': p[-1] = '\\'; break;
+ case 0: *p = 0; return;
+ default: p[-1] = q[-1]; break;
+ }
+}
+
int
main(argc, argv)
int argc;
#endif
#endif
-
setbuf(stdout, NULL);
setbuf(stderr, NULL);
debugFP = stderr;
j = fprintf(stderr, " %s%s", shellOptions[i].option,
(shellOptions[i].argKind == XrmoptionSepArg
? " ARG" : ""));
- if (i++ < XtNumber(shellOptions)) {
+ if (i++ < XtNumber(shellOptions)) {
fprintf(stderr, "%*c%s%s\n", 40 - j, ' ',
shellOptions[i].option,
(shellOptions[i].argKind == XrmoptionSepArg
exit(2);
}
- if ((chessDir = (char *) getenv("CHESSDIR")) == NULL) {
- chessDir = ".";
- } else {
- if (chdir(chessDir) != 0) {
- fprintf(stderr, _("%s: can't cd to CHESSDIR: "), programName);
- perror(chessDir);
- exit(1);
- }
- }
-
p = getenv("HOME");
if (p == NULL) p = "/tmp";
i = strlen(p) + strlen("/.xboardXXXXXx.pgn") + 1;
clientResources, XtNumber(clientResources),
NULL, 0);
+ { // [HGM] initstring: kludge to fix bad bug. expand '\n' characters in init string and computer string.
+ static char buf[MSG_SIZ];
+ EscapeExpand(buf, appData.initString);
+ appData.initString = strdup(buf);
+ EscapeExpand(buf, appData.secondInitString);
+ appData.secondInitString = strdup(buf);
+ EscapeExpand(buf, appData.firstComputerString);
+ appData.firstComputerString = strdup(buf);
+ EscapeExpand(buf, appData.secondComputerString);
+ appData.secondComputerString = strdup(buf);
+ }
+
+ if ((chessDir = (char *) getenv("CHESSDIR")) == NULL) {
+ chessDir = ".";
+ } else {
+ if (chdir(chessDir) != 0) {
+ fprintf(stderr, _("%s: can't cd to CHESSDIR: "), programName);
+ perror(chessDir);
+ exit(1);
+ }
+ }
+
if (appData.debugMode && appData.nameOfDebugFile && strcmp(appData.nameOfDebugFile, "stderr")) {
/* [DM] debug info to file [HGM] make the filename a command-line option, and allow it to remain stderr */
if ((debugFP = fopen(appData.nameOfDebugFile, "w")) == NULL) {
if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
&(xpmPieceBitmap2[kind][piece]),
NULL, &attr)) != 0) {
- fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),
- r, buf);
- exit(1);
+ if(piece != (int)WhiteKing && piece > (int)WhiteQueen) {
+ // [HGM] missing: read of unorthodox piece failed; substitute King.
+ snprintf(buf, sizeof(buf), "%s/k%s%u.xpm",
+ ExpandPathName(appData.pixmapDirectory),
+ xpmkind[kind], ss);
+ if (appData.debugMode) {
+ fprintf(stderr, _("(Replace by File:%s:) "), buf);
+ }
+ r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
+ &(xpmPieceBitmap2[kind][piece]),
+ NULL, &attr);
+ }
+ if (r != 0) {
+ fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),
+ r, buf);
+ exit(1);
+ }
}
if(piece <= (int) WhiteKing)
xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
x >= 0 && y >= 0) {
ChessSquare fromP;
ChessSquare toP;
+ int frc;
/* Check if clicking again on the same color piece */
fromP = boards[currentMove][fromY][fromX];
toP = boards[currentMove][y][x];
- if ((WhitePawn <= fromP && fromP < WhiteKing && // [HGM] this test should go, as UserMoveTest now does it.
- WhitePawn <= toP && toP <= WhiteKing) || // For now I made it less critical by exempting King
- (BlackPawn <= fromP && fromP < BlackKing && // moves, to not interfere with FRC castlings.
- BlackPawn <= toP && toP <= BlackKing)) {
+ frc = gameInfo.variant == VariantFischeRandom || gameInfo.variant == VariantCapaRandom;
+ if ((WhitePawn <= fromP && fromP <= WhiteKing && // [HGM] this test should go, as UserMoveTest now does it.
+ WhitePawn <= toP && toP <= WhiteKing &&
+ !(fromP == WhiteKing && toP == WhiteRook && frc)) ||
+ (BlackPawn <= fromP && fromP <= BlackKing &&
+ BlackPawn <= toP && toP <= BlackKing &&
+ !(fromP == BlackKing && toP == BlackRook && frc))) {
/* Clicked again on same color piece -- changed his mind */
second = (x == fromX && y == fromY);
if (appData.highlightDragging) {
void DisplayMessage(message, extMessage)
char *message, *extMessage;
{
- char buf[MSG_SIZ];
- Arg arg;
-
- if (extMessage) {
- if (*message) {
- snprintf(buf, sizeof(buf), "%s %s", message, extMessage);
- message = buf;
- } else {
- message = extMessage;
- }
- }
- XtSetArg(arg, XtNlabel, message);
- XtSetValues(messageWidget, &arg, 1);
+ /* display a message in the message widget */
+
+ char buf[MSG_SIZ];
+ Arg arg;
+
+ if (extMessage)
+ {
+ if (*message)
+ {
+ snprintf(buf, sizeof(buf), "%s %s", message, extMessage);
+ message = buf;
+ }
+ else
+ {
+ message = extMessage;
+ };
+ };
+
+ /* need to test if messageWidget already exists, since this function
+ can also be called during the startup, if for example a Xresource
+ is not set up correctly */
+ if(messageWidget)
+ {
+ XtSetArg(arg, XtNlabel, message);
+ XtSetValues(messageWidget, &arg, 1);
+ };
+
+ return;
}
void DisplayTitle(text)
ScheduleDelayedEvent(cb, millisec)
DelayedEventCallback cb; long millisec;
{
+ if(delayedEventTimerXID && delayedEventCallback == cb)
+ // [HGM] alive: replace, rather than add or flush identical event
+ XtRemoveTimeOut(delayedEventTimerXID);
delayedEventCallback = cb;
delayedEventTimerXID =
XtAppAddTimeOut(appContext, millisec,