From a4f1e60ece6dac22c4d913fc70124873803f30ab Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 20 May 2022 01:38:05 -0700 Subject: web: add (incomplete) support for 3+ player matches --- web/web_control.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'web/web_control.c') diff --git a/web/web_control.c b/web/web_control.c index 74d42e2..5389a23 100644 --- a/web/web_control.c +++ b/web/web_control.c @@ -260,6 +260,9 @@ void match_mode_selected(int mode) match_opts->p1_type = PT_COMP; match_opts->p2_name = "Computer 2"; match_opts->p2_type = PT_COMP; + } else if (mode == M_PVPVP) { + match_opts->p1_name = "Player 1"; + match_opts->p2_name = "Player 2"; } prompt_match_opts(); @@ -273,17 +276,14 @@ void start_match() match_opts->p1_name); match_add_player(match_opts->start_pts, match_opts->p2_type, match_opts->p2_name ? match_opts->p2_name : "oi"); - - show_player_info(1); - update_player_name(1, state->legs[0]->name); - update_player_rem(1, state->legs[0]->rem); - update_player_avg(1, 0); - - if (match_num_players() != 1) { - show_player_info(2); - update_player_name(2, state->legs[1]->name); - update_player_rem(2, state->legs[1]->rem); - update_player_avg(2, 0); + if (match_opts->mode == M_PVPVP) + match_add_player(match_opts->start_pts, PT_USER, "Player 3"); + + scoreboard_show_info(match_num_players()); + for (int i = 1; i <= match_num_players(); ++i) { + update_player_name(i, state->legs[i - 1]->name); + update_player_rem(i, state->legs[i - 1]->rem); + update_player_avg(i, 0); } dom_enable_exit_dialogue(true); -- cgit v1.2.3-70-g09d2