diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 23:39:12 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 23:39:12 -0700 |
commit | 90b5ca5e47f0fda21f8da6cb9857a35e0f4730a3 (patch) | |
tree | 05c3bae5829fcdcc5df2bebd36c504efea974494 /web/web_scoreboard.c | |
parent | 1def0d71449f95c1fb609053b84a92e8adbb0eb1 (diff) | |
download | dartboat-90b5ca5e47f0fda21f8da6cb9857a35e0f4730a3.tar.gz dartboat-90b5ca5e47f0fda21f8da6cb9857a35e0f4730a3.tar.xz |
web: allow selection of starting points and user to throw first
This new option selection code is a bit messy for now. It requires the
options and their order to be in sync between the prompt functions and
the corresponding submit functions. There's also a bit too much
repetition of generic code that's applicable to all options.
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r-- | web/web_scoreboard.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index 495a7b6..8a6def0 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -192,7 +192,11 @@ void draw_visits() } for (int i = 0; i < n_visits; ++i) { - struct visit *v = state->legs[0]->visits + i; + struct visit *v; + + if (i >= state->legs[0]->n_visits) + goto p2; + v = state->legs[0]->visits + i; snprintf(buf, sizeof(buf), "%d", v->points); snprintf(buf2, sizeof(buf2), "%s %s", @@ -205,6 +209,7 @@ void draw_visits() snprintf(buf, sizeof(buf), "%d", i + 1); elemv[elemc++] = create_div(buf, "visit-n"); +p2: if (i >= state->legs[1]->n_visits) continue; v = state->legs[1]->visits + i; |