diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-15 02:44:24 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-15 02:44:24 -0700 |
commit | e7ea69b2603e7047ad13774b648dc2fb4089af6b (patch) | |
tree | f538fd617a804de250e73396e7a587ad1dffcddd /web/web_opts.c | |
parent | 4bec4883792f86cd835936113a9d39bebcf0344f (diff) | |
download | dartboat-e7ea69b2603e7047ad13774b648dc2fb4089af6b.tar.gz dartboat-e7ea69b2603e7047ad13774b648dc2fb4089af6b.tar.xz |
web: avoid setting stdev twice on load
Diffstat (limited to 'web/web_opts.c')
-rw-r--r-- | web/web_opts.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/web/web_opts.c b/web/web_opts.c index e1c5eb5..b459305 100644 --- a/web/web_opts.c +++ b/web/web_opts.c @@ -4,6 +4,7 @@ #include "comp.h" #include <math.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -80,31 +81,31 @@ char *read_opt(char *opt) return val; } -void read_delay() +bool read_delay() { char *val = read_opt("delay"); - if (!val) return; + if (!val) return false; set_delay(val); free(val); + return true; } -void read_difficulty() +bool read_difficulty() { char *val = read_opt("difficulty"); - if (!val) return; + if (!val) return false; set_difficulty(val); free(val); + return true; } void opts_init() { - // TODO call only when no stored diff setting - set_stdev(difficulty); - read_delay(); - read_difficulty(); + if (!read_difficulty()) + set_stdev(difficulty); char buf[64]; sprintf(buf, "%d", delay_ms); |