summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/web_opts.c17
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);