From 0bff498964becbf1302e249da99c47c6d20afe3e Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 21 Oct 2014 22:07:09 +0200 Subject: [PATCH] Fix variant-name recognition StringToVariant did recognize whether the name to recognize had suffuxes compared to the tabulated name, but not if it had prefixes. So 'shoshogi' would be recognized as 'shogi'. --- backend.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.c b/backend.c index bab4386..4cc497f 100644 --- a/backend.c +++ b/backend.c @@ -2108,14 +2108,14 @@ StringToVariant (char *e) int wnum = -1; VariantClass v = VariantNormal; int i, found = FALSE; - char buf[MSG_SIZ]; + char buf[MSG_SIZ], c; int len; if (!e) return v; /* [HGM] skip over optional board-size prefixes */ - if( sscanf(e, "%dx%d_", &i, &i) == 2 || - sscanf(e, "%dx%d+%d_", &i, &i, &i) == 3 ) { + if( sscanf(e, "%dx%d_%c", &i, &i, &c) == 3 || + sscanf(e, "%dx%d+%d_%c", &i, &i, &i, &c) == 4 ) { while( *e++ != '_'); } @@ -2125,7 +2125,7 @@ StringToVariant (char *e) } else for (i=0; i= VariantShogi && isalpha(p[strlen(variantNames[i])])) continue; + if(p && i >= VariantShogi && (p != e || isalpha(p[strlen(variantNames[i])]))) continue; v = (VariantClass) i; found = TRUE; break; -- 1.7.0.4