From: H.G.Muller Date: Tue, 22 Mar 2016 14:10:43 +0000 (+0100) Subject: Add -men option for changing piece moves X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=2087ac0f61e84f7f71cbea5a0a3325374f9e76ee Add -men option for changing piece moves A volatile string option -men allows the user to change the moves of the pieces from the command line similar to what the VariantMen tag does from a PGN file. Using the New Variant dialog resets the option. --- diff --git a/args.h b/args.h index a2f3b46..30ffe16 100644 --- a/args.h +++ b/args.h @@ -715,6 +715,7 @@ ArgDescriptor argDescriptors[] = { { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" }, { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" }, { "fen", ArgString, (void *) &appData.fen, FALSE, (ArgIniType) "" }, + { "men", ArgString, (void *) &appData.men, FALSE, (ArgIniType) "" }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/backend.c b/backend.c index c5be312..734cf40 100644 --- a/backend.c +++ b/backend.c @@ -6459,6 +6459,7 @@ InitPosition (int redraw) initialRights[i] = filePosition[CASTLING][i]; startedFromSetupPosition = TRUE; } + if(*appData.men) LoadPieceDesc(appData.men); CopyBoard(boards[0], initialPosition); diff --git a/common.h b/common.h index 6c2a60f..b0a30c3 100644 --- a/common.h +++ b/common.h @@ -801,6 +801,7 @@ typedef struct { char *message; char *suppress; char *fen; + char *men; char *tourneyFile; char *defName; char *processes; diff --git a/dialogs.c b/dialogs.c index 189a869..d8f1684 100644 --- a/dialogs.c +++ b/dialogs.c @@ -557,6 +557,7 @@ Pick (int n) appData.pieceToCharTable = NULL; appData.pieceNickNames = ""; appData.colorNickNames = ""; + appData.men = ""; PopDown(TransientDlg); Reset(True, True); return; diff --git a/moves.c b/moves.c index ca2625c..08de082 100644 --- a/moves.c +++ b/moves.c @@ -241,6 +241,7 @@ LoadPieceDesc (char *s) char *r, *p, *q = s; int ok = TRUE, promoted, c; while(q && *s) { +printf("pstring = %s\n", s); p = s; q = strchr(s, ';'); if(q) *q = 0, s = q+1; @@ -261,6 +262,7 @@ LoadPieceDesc (char *s) ASSIGN(pieceDesc[WHITE_TO_BLACK piece], p); } pieceDefs = TRUE; + if(q) *q = ';'; } return ok; } diff --git a/winboard/woptions.c b/winboard/woptions.c index e6d6e80..94b1ef5 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -982,6 +982,7 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) shuffleOpenings = FALSE; /* [HGM] shuffle: possible shuffle reset when we switch */ startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */ appData.pieceToCharTable = NULL; + appData.men = ""; Reset(TRUE, TRUE); return TRUE;