summaryrefslogtreecommitdiff
path: root/web/web_control.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 02:03:13 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 02:03:35 -0700
commit7797f45a97681ca513cb75a7e6a322be3ec5003a (patch)
treeb8b3e4e8a6482064aab345f82469ebcafeba0d9f /web/web_control.c
parentdc7c6379f0ef9db382a5445954a4be37e2ec5640 (diff)
downloaddartboat-7797f45a97681ca513cb75a7e6a322be3ec5003a.tar.gz
dartboat-7797f45a97681ca513cb75a7e6a322be3ec5003a.tar.xz
web: remove hard-coded match modes
Diffstat (limited to 'web/web_control.c')
-rw-r--r--web/web_control.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/web/web_control.c b/web/web_control.c
index a5edb82..c561250 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -235,16 +235,11 @@ void user_num_darts(int n)
void start_match()
{
match_new();
- match_add_player(match_opts->start_pts, match_opts->p1_type,
- match_opts->p1_name);
- match_add_player(match_opts->start_pts, match_opts->p2_type,
- match_opts->p2_name ? match_opts->p2_name : "oi");
- if (match_opts->mode == M_PVPVP)
- match_add_player(match_opts->start_pts, PT_USER, "Player 3");
- else if (match_opts->mode == M_PVCVCVC) {
- match_add_player(match_opts->start_pts, PT_COMP, "Computer 2");
- match_add_player(match_opts->start_pts, PT_COMP, "Computer 3");
- }
+
+ for (int i = 0; i < match_opts->num_players; ++i)
+ match_add_player(match_opts->start_pts,
+ match_opts->players[i].type,
+ match_opts->players[i].name);
scoreboard_show_info(match_num_players());
for (int i = 1; i <= match_num_players(); ++i) {