From 635daf56748af66bf3185d85fb83b12280ef6c83 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 22 Mar 2016 14:56:10 +0100 Subject: [PATCH] Add -fen option A volatile string option -fen can now be used to set the initial position of the initial variant through the command line, removing the need to prepare a position file for this. Otherwise the effect should be the same as when using -lpf: New games will be started from the specifoed positon until the New Variant dialog is used. The position is 'auto-sizing', i.e. the FEN is used to set the board geometry as well. --- args.h | 1 + backend.c | 5 +++++ common.h | 1 + 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/args.h b/args.h index 866a6a9..a2f3b46 100644 --- a/args.h +++ b/args.h @@ -714,6 +714,7 @@ ArgDescriptor argDescriptors[] = { { "memoHeaders", ArgBoolean, (void *) &appData.headers, TRUE, (ArgIniType) FALSE }, { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" }, { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" }, + { "fen", ArgString, (void *) &appData.fen, FALSE, (ArgIniType) "" }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/backend.c b/backend.c index e7cf5b2..c5be312 100644 --- a/backend.c +++ b/backend.c @@ -1743,6 +1743,11 @@ InitBackEnd3 P((void)) CopyBoard(filePosition, boards[0]); CopyBoard(initialPosition, boards[0]); } + } else if(*appData.fen != NULLCHAR) { + if(ParseFEN(filePosition, &blackPlaysFirst, appData.fen, TRUE) && !blackPlaysFirst) { + startedFromPositionFile = TRUE; + Reset(TRUE, TRUE); + } } if (initialMode == AnalyzeMode) { if (appData.noChessProgram) { diff --git a/common.h b/common.h index c98ba91..6c2a60f 100644 --- a/common.h +++ b/common.h @@ -800,6 +800,7 @@ typedef struct { char *recentEngineList; char *message; char *suppress; + char *fen; char *tourneyFile; char *defName; char *processes; -- 1.7.0.4