From 0ccbe7c602352f55e143e4e533c3c2b7b773dda6 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 30 Jul 2010 23:21:50 +0200 Subject: [PATCH] Add string option /pieceNickNames This (volatile) option allows definition of alternate letters for the pieces, which will be recognized next to the standard symbols as given in the /pieceToCharTable on input. (Output always uses the standard.) This can be useful for reading PGN from another language, or non-compliant FENs (e.g. using B and N for E and H in Xiangqi). The format of the argument is the same as for /pieceToCharTable. Because the nickNames are consulted before the standard table, it is possible to redefine a standard name as a nick for another piece. --- args.h | 1 + backend.c | 7 ++++++- common.h | 1 + moves.c | 3 +++ moves.h | 1 + 5 files changed, 12 insertions(+), 1 deletions(-) diff --git a/args.h b/args.h index b16b963..e6c72f8 100644 --- a/args.h +++ b/args.h @@ -549,6 +549,7 @@ ArgDescriptor argDescriptors[] = { { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, TRUE, (ArgIniType) -1 }, { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 }, { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID }, + { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID }, { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, TRUE, (ArgIniType) FALSE }, { "allWhite", ArgBoolean, (void *) &appData.allWhite, TRUE, (ArgIniType) FALSE }, { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE }, diff --git a/backend.c b/backend.c index 99aceae..661476c 100644 --- a/backend.c +++ b/backend.c @@ -234,6 +234,7 @@ char *ProbeBook P((int moveNr, char *book)); // [HGM] book: returns a book move char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book void ics_update_width P((int new_width)); extern char installDir[MSG_SIZ]; +VariantClass startVariant; /* [HGM] nicks: initial variant */ extern int tinyLayout, smallLayout; ChessProgramStats programStats; @@ -637,6 +638,7 @@ InitBackEnd1() int matched, min, sec; ShowThinkingEvent(); // [HGM] thinking: make sure post/nopost state is set according to options + startVariant = StringToVariant(appData.variant); // [HGM] nicks: remember original variant GetTimeMark(&programStartTime); srandom((programStartTime.ms + 1000*programStartTime.sec)*0x1001001); // [HGM] book: makes sure random is unpredictabe to msec level @@ -5260,7 +5262,10 @@ InitPosition(redraw) for(i=0; i