summaryrefslogtreecommitdiff
path: root/web/web_control.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 16:54:58 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 16:54:58 -0700
commit9ee81a83ee971b316446e337110d3bbfea7bfc8f (patch)
tree4e374d5f0dee387c2e0d8f9389aeefbc4fe935e3 /web/web_control.c
parent3fda7193b52eed1c724b6d5e5b8373c0a3fbf963 (diff)
downloaddartboat-9ee81a83ee971b316446e337110d3bbfea7bfc8f.tar.gz
dartboat-9ee81a83ee971b316446e337110d3bbfea7bfc8f.tar.xz
web: use match info funcs instead of checking mode
Diffstat (limited to 'web/web_control.c')
-rw-r--r--web/web_control.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/web/web_control.c b/web/web_control.c
index 4d62c05..c9fb138 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -22,7 +22,7 @@ void set_active_player(int pn)
state->active_player = pn;
scoreboard_set_player_active(pn);
- if (state->mode == M_PVC && pn == 2)
+ if (match_player_is_comp(pn))
prompt_bot_visit();
else
prompt_visit();
@@ -130,22 +130,18 @@ void handle_next()
prompt_select_mode();
} else if (match_is_over()) {
if (state->num_darts ||
- (state->mode == M_PVC && state->legs[1]->rem <= 0))
+ match_player_is_comp(match_winning_player()))
prompt_end_match();
else
prompt_num_darts();
} else {
- if (state->mode == M_P) {
- set_active_player(1);
- } else {
- if (state->active_player)
- set_active_player(match_next_player());
- else
- set_active_player(match_opts->throws_first);
-
- if (state->mode == M_PVC && state->active_player == 2)
- boat_visit();
- }
+ if (state->active_player)
+ set_active_player(match_next_player());
+ else
+ set_active_player(match_opts->throws_first);
+
+ if (match_player_is_comp(state->active_player))
+ boat_visit();
}
prompt_flush();
@@ -283,7 +279,7 @@ void start_match()
update_player_rem(1, state->legs[0]->rem);
update_player_avg(1, 0);
- if (state->mode != M_P) {
+ 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);