summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-20 03:08:08 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-20 03:08:08 -0700
commitd769efe8d1cf7a21844e1ba716042e897e947f3f (patch)
tree9775e338800471da281bfcd70cd2821d4bea767c /web
parent48814611e9b638c4b2475fec129d83dcf92a889b (diff)
downloaddartboat-d769efe8d1cf7a21844e1ba716042e897e947f3f.tar.gz
dartboat-d769efe8d1cf7a21844e1ba716042e897e947f3f.tar.xz
web: use configured number of slots in show function
Diffstat (limited to 'web')
-rw-r--r--web/web_scoreboard.c12
1 files changed, 6 insertions, 6 deletions
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");
}