summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 02:08:24 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 02:08:24 -0700
commitf5272c406c363013b10b801785900c5ae5bf5b79 (patch)
tree1d537d4064576a325c31c9ee3b78da0d2ffc2021 /web
parent7797f45a97681ca513cb75a7e6a322be3ec5003a (diff)
downloaddartboat-f5272c406c363013b10b801785900c5ae5bf5b79.tar.gz
dartboat-f5272c406c363013b10b801785900c5ae5bf5b79.tar.xz
web: don't try checking player 2 visits when there is only one player
Diffstat (limited to 'web')
-rw-r--r--web/web_scoreboard.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c
index f298dfe..62b4c0f 100644
--- a/web/web_scoreboard.c
+++ b/web/web_scoreboard.c
@@ -382,8 +382,9 @@ void draw_visits()
dom_set_content("#visits", NULL);
dom_remove_class("#visits", "dense");
- int n_visits = state->legs[0]->n_visits > state->legs[1]->n_visits ?
- state->legs[0]->n_visits : state->legs[1]->n_visits;
+ int n_visits = state->legs[0]->n_visits;
+ if (match_num_players() != 1 && state->legs[1]->n_visits > n_visits)
+ n_visits = state->legs[1]->n_visits;
struct dom_elem **elemv = malloc(7 * (n_visits + 1) * sizeof(*elemv));
int elemc = 0;
@@ -434,7 +435,7 @@ p2:
snprintf(buf, sizeof(buf), "%d", i + 1);
elemv[elemc++] = create_div(buf, "visit-n");
- if (i >= state->legs[1]->n_visits)
+ if (match_num_players() == 1 || i >= state->legs[1]->n_visits)
continue;
v = state->legs[1]->visits + i;