From: H.G. Muller Date: Fri, 6 May 2011 16:51:20 +0000 (+0200) Subject: Add -first/secondPgnName option X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=c90dc392ef0e30c7fd481ee47bd9a39aafebcdf4 Add -first/secondPgnName option This option replaces the tidy name of the engine in the PGN player tags of engine-engine games. In WinBoard engines can be installed with this option through a checkbox in the Load Engine dialog. --- diff --git a/args.h b/args.h index c0e569b..693877e 100644 --- a/args.h +++ b/args.h @@ -609,6 +609,10 @@ ArgDescriptor argDescriptors[] = { { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID }, { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID }, { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, FALSE }, + { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" }, + { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID }, + { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" }, + { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/backend.c b/backend.c index 20f9413..a0bffa5 100644 --- a/backend.c +++ b/backend.c @@ -862,7 +862,7 @@ ReplaceEngine(ChessProgramState *cps, int n) } extern char *engineName, *engineDir, *engineChoice, *engineLine, *nickName, *params; -extern Boolean isUCI, hasBook, storeVariant, v1, addToList; +extern Boolean isUCI, hasBook, storeVariant, v1, addToList, useNick; void Load(ChessProgramState *cps, int i) @@ -871,7 +871,7 @@ Load(ChessProgramState *cps, int i) if(engineLine[0]) { // an engine was selected from the combo box snprintf(buf, MSG_SIZ, "-fcp %s", engineLine); SwapEngines(i); // kludge to parse -f* / -first* like it is -s* / -second* - ParseArgsFromString("-firstIsUCI false -firstHasOwnBookUCI true -firstTimeOdds 1"); + ParseArgsFromString("-firstIsUCI false -firstHasOwnBookUCI true -firstTimeOdds 1 -fn \"\""); ParseArgsFromString(buf); SwapEngines(i); ReplaceEngine(cps, i); @@ -895,11 +895,16 @@ Load(ChessProgramState *cps, int i) appData.isUCI[i] = isUCI; appData.protocolVersion[i] = v1 ? 1 : PROTOVER; appData.hasOwnBookUCI[i] = hasBook; + if(!nickName[0]) useNick = FALSE; + if(useNick) ASSIGN(appData.pgnName[i], nickName); if(addToList) { int len; q = firstChessProgramNames; if(nickName[0]) snprintf(buf, MSG_SIZ, "\"%s\" -fcp ", nickName); else buf[0] = NULLCHAR; - snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), "\"%s\" -fd \"%s\"%s%s%s%s%s\n", p, appData.directory[i], + snprintf(buf+strlen(buf), MSG_SIZ-strlen(buf), "\"%s\" -fd \"%s\"%s%s%s%s%s%s%s%s\n", p, appData.directory[i], + useNick ? " -fn \"" : "", + useNick ? nickName : "", + useNick ? "\"" : "", v1 ? " -firstProtocolVersion 1" : "", hasBook ? "" : " -fNoOwnBookUCI", isUCI ? " -fUCI" : "", @@ -9544,6 +9549,7 @@ void SwapEngines(int n) SWAP(scoreIsAbsolute, h) SWAP(timeOdds, h) SWAP(logo, p) + SWAP(pgnName, p) } void @@ -9552,7 +9558,7 @@ SetPlayer(int player) int i; char buf[MSG_SIZ], *engineName, *p = appData.participants; static char resetOptions[] = "-reuse -firstIsUCI false -firstHasOwnBookUCI true -firstTimeOdds 1 -firstOptions \"\" " - "-firstNeedsNoncompliantFEN false -firstNPS -1"; + "-firstNeedsNoncompliantFEN false -firstNPS -1 -fn \"\""; for(i=0; i