From dc7c6379f0ef9db382a5445954a4be37e2ec5640 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 21 May 2022 00:52:50 -0700 Subject: web: reimplement menus as a stack with more shared code --- web/web_control.c | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) (limited to 'web/web_control.c') diff --git a/web/web_control.c b/web/web_control.c index ca45ed4..a5edb82 100644 --- a/web/web_control.c +++ b/web/web_control.c @@ -124,7 +124,7 @@ void boat_visit() void handle_next() { if (!state) { - prompt_select_mode(); + prompt_main_menu(); } else if (match_is_over()) { if (state->num_darts || match_player_is_comp(match_winning_player())) @@ -232,47 +232,6 @@ void user_num_darts(int n) handle_next(); } -void match_mode_selected(int mode) -{ - if (mode < M_FIRST || mode > M_LAST) { - oi(); - return; - } - - if (match_opts) match_opts_free(); - match_opts = calloc(1, sizeof(*match_opts)); - match_opts->mode = mode; - match_opts->start_pts = 501; - match_opts->throws_first = 1; - // names need to be freed if we stop using string literals - if (mode == M_PVC) { - match_opts->p1_name = "User"; - match_opts->p2_name = "Computer"; - match_opts->p2_type = PT_COMP; - } else if (mode == M_P) { - match_opts->p1_name = "Player 1"; - match_opts->p2_name = NULL; - } else if (mode == M_PVP) { - match_opts->p1_name = "Player 1"; - match_opts->p2_name = "Player 2"; - } else if (mode == M_CVC) { - match_opts->p1_name = "Computer 1"; - 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"; - } else if (mode == M_PVCVCVC) { - match_opts->p1_name = "User"; - match_opts->p2_type = PT_COMP; - match_opts->p2_name = "Computer 1"; - } - - prompt_match_opts(); - prompt_flush(); -} - void start_match() { match_new(); -- cgit v1.2.3-70-g09d2