From: H.G. Muller Date: Wed, 13 Apr 2011 09:15:14 +0000 (+0200) Subject: Fix changing of float setting by generic popup X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f09bb2248bceae137817926c5bacd1f5b73c0019;p=xboard.git Fix changing of float setting by generic popup Changing a float setting (so far the only one is in the Load Options dalog) did not always work, because the old value was clipped to (int), so that changing it back to an integer value might erroneously conclude there was no change. --- diff --git a/xoptions.c b/xoptions.c index 1bccfc3..1d51738 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1237,13 +1237,14 @@ void GenericReadout() sscanf(val, "%f", &x); if(x > currentOption[i].max) x = currentOption[i].max; if(x < currentOption[i].min) x = currentOption[i].min; - if(currentOption[i].value != x) { + if(currentOption[i].type == Fractional) + *(float*) currentOption[i].target = x; // engines never have float options! + else if(currentOption[i].value != x) { currentOption[i].value = x; - if(currentCps) { // engines never have float options, so no decimals! + if(currentCps) { snprintf(buf, MSG_SIZ, "option %s=%.0f\n", currentOption[i].name, x); SendToProgram(buf, currentCps); - } else if(currentOption[i].type == Spin) *(int*) currentOption[i].target = x; - else *(float*) currentOption[i].target = x; + } else *(int*) currentOption[i].target = x; } break; case CheckBox: