From d769efe8d1cf7a21844e1ba716042e897e947f3f Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 20 May 2022 03:08:08 -0700 Subject: web: use configured number of slots in show function --- web/web_scoreboard.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'web') diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index 7dc4b8e..769d68e 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -227,15 +227,15 @@ void scoreboard_show_info(int num_players) if (bufs) free(bufs); bufs = calloc(num_players, sizeof(*bufs)); - set_slot_player(1, 1); - dom_add_class("#info-slot-1 .inner", "visible"); + for (int i = 1; i <= num_players && i <= NUM_SLOTS; ++i) { + set_slot_player(i, i); - if (num_players > 1) { - set_slot_player(2, 2); - dom_add_class("#info-slot-2 .inner", "visible"); + char buf[64]; + sprintf(buf, "#info-slot-%d .inner", i); + dom_add_class(buf, "visible"); } - if (num_players > 2) { + if (num_players > NUM_SLOTS) { dom_add_class("#info-slot-prev", "visible"); dom_add_class("#info-slot-next", "visible"); } -- cgit v1.2.3-70-g09d2