From: H.G.Muller Date: Sat, 5 Mar 2016 21:42:33 +0000 (+0100) Subject: Beef up variant detection in New Variant dialog WB X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1041d8a7aa236941d133d8992dbe0fb39fd57b53;p=xboard.git Beef up variant detection in New Variant dialog WB In WinBoard the enabling of radio buttons was still done when the variant nameon the button was a sub-string of the variants feature, without requiring a match of the full name (so that 'grande-acedrex' would enable the 'grand' button of Grand Chess). --- diff --git a/winboard/woptions.c b/winboard/woptions.c index 0d22012..d4f54d0 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -896,13 +896,14 @@ VariantWhichRadio(HWND hDlg) void VariantShowRadio(HWND hDlg) { - char c = *engineVariant; + char c = *engineVariant, *v, *p; int i=0, j; CheckDlgButton(hDlg, radioButton[gameInfo.variant], TRUE); *engineVariant = NULLCHAR; // [HGM] kludge to prevent VariantName will always return engineVariant while((j = radioButton[i++]) != -2) { if(j == -1) continue; // no menu button - EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || strstr(first.variants, VariantName(i-1))); + v = VariantName(i-1); p = strstr(first.variants, v); + EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || p && (!*v || strlen(v) == strlen[p] || p[strlen[v]] == ',')); } *engineVariant = c; for(i=0; i<15; i++) { // initialize engine-defined variants