From f09bb2248bceae137817926c5bacd1f5b73c0019 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 13 Apr 2011 11:15:14 +0200 Subject: [PATCH] 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. --- xoptions.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) 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: -- 1.7.0.4