summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-01-11 12:29:42 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-11 12:39:54 -0800
commit954290c70ba525cab4fefe83a3e82384ef01ba8c (patch)
treeeba4c224cefdcf04fb566656ce3ce14cc9035d02
parentc44755878c9dea2349d9a88939652047be8f539a (diff)
downloadsubsurface-954290c70ba525cab4fefe83a3e82384ef01ba8c.tar.gz
Fix default gradient factor setting
Testing the new "don't even bother saving default values" showed that the default values for the deco gradient factors were undefined. Or rather, they were over-defined. We had defaults for the UI (30 and 75 for GFlow/GFhigh respectively - the config ones are in percent), *and* we had defaults in deco.c for the deco code itself (0.35 and 0.75 respectively - in deco.c they are represented as fractions, not percent). And if the config entries had never been written, and were assumed to be the defaults, the UI code thought the defaults were 30/75, but they had never been *set* to those defaults, so actual default calculations silently used the 35/75 in deco.c, which is very confusing (you could go to the preferences page, see the 30/75 there, and it would not actually match th evalues used for computation). Of course, with an old config file that saves even default entries, you'd never see that if you ever changed anything in the preferences, because you'd always have explicit gflow/high values. But now it's much easier to see the conflicting default values. Fix it by just always using the UI defaults (or set values) to set the actual deco values. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--prefs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/prefs.c b/prefs.c
index 9dbb9ed4a..d15a97dd9 100644
--- a/prefs.c
+++ b/prefs.c
@@ -144,16 +144,15 @@ void load_preferences(void)
if (conf_value) {
sscanf(conf_value, "%lf", &prefs.gflow);
prefs.gflow /= 100.0;
- set_gf(prefs.gflow, -1.0);
free((void *)conf_value);
}
conf_value = subsurface_get_conf("gfhigh");
if (conf_value) {
sscanf(conf_value, "%lf", &prefs.gfhigh);
prefs.gfhigh /= 100.0;
- set_gf(-1.0, prefs.gfhigh);
free((void *)conf_value);
}
+ set_gf(prefs.gflow, prefs.gfhigh);
divelist_font = subsurface_get_conf("divelist_font");
default_filename = subsurface_get_conf("default_filename");