From f5272c406c363013b10b801785900c5ae5bf5b79 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 21 May 2022 02:08:24 -0700 Subject: web: don't try checking player 2 visits when there is only one player --- web/web_scoreboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'web') 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; -- cgit v1.2.3-70-g09d2