summaryrefslogtreecommitdiff
path: root/web/web_control.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 00:52:50 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 00:52:50 -0700
commitdc7c6379f0ef9db382a5445954a4be37e2ec5640 (patch)
tree8aaa566b6b0906071659626b1c144be5a2da0c07 /web/web_control.c
parent6fb1750b923b97a377d6ef8ad4a25b501e65b39d (diff)
downloaddartboat-dc7c6379f0ef9db382a5445954a4be37e2ec5640.tar.gz
dartboat-dc7c6379f0ef9db382a5445954a4be37e2ec5640.tar.xz
web: reimplement menus as a stack with more shared code
Diffstat (limited to 'web/web_control.c')
-rw-r--r--web/web_control.c43
1 files changed, 1 insertions, 42 deletions
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();