summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 17:56:31 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 17:56:31 -0700
commitd4a44af5efa5d3847a4ec4c545d585770e92e4b9 (patch)
tree1b5e16d042fb85d649f1ec94666f691f53e52be3 /web
parent1b0b79f6778666f487a9b82d4c47dd3a94ad9fcb (diff)
downloaddartboat-d4a44af5efa5d3847a4ec4c545d585770e92e4b9.tar.gz
dartboat-d4a44af5efa5d3847a4ec4c545d585770e92e4b9.tar.xz
web: remove assumption that comp is player 2
Diffstat (limited to 'web')
-rw-r--r--web/web_control.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/web/web_control.c b/web/web_control.c
index 8d01e5a..0c08b40 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -41,8 +41,8 @@ void end_boat_visit(int rem, double avg, int match_id)
return;
svg_clear_points();
- update_player_rem(2, rem);
- scoreboard_set_player_avg(2, avg);
+ update_player_rem(state->active_player, rem);
+ scoreboard_set_player_avg(state->active_player, avg);
prompt_set_input(NULL);
prompt_set_msgr(NULL);
@@ -59,18 +59,17 @@ void draw_boat_throwing(int pts, char *str, double x, double y, int match_id)
char pts_str[10];
sprintf(pts_str, "%d", pts);
- int rem = state->legs[1]->n_visits > 1 ?
- state->legs[1]->visits[state->legs[1]->n_visits-2].rem :
- state->legs[1]->start;
+ struct leg *l = state_active_leg();
+ int rem = l->n_visits > 1 ? l->visits[l->n_visits-2].rem : l->start;
svg_draw_point(x, y);
- update_player_rem(2, rem - pts);
+ update_player_rem(state->active_player, rem - pts);
prompt_set_input(pts_str);
prompt_set_msgr(str);
free(str);
prompt_flush();
- scoreboard_flush_player_info(2);
+ scoreboard_flush_player_info(state->active_player);
}
static void schedule_boat_visit_draws(struct leg *l, struct visit *v,
@@ -105,7 +104,7 @@ static void schedule_boat_visit_draws(struct leg *l, struct visit *v,
void boat_visit()
{
- struct leg *l = state->legs[1];
+ struct leg *l = state_active_leg();
if (state->boat_undone) {
--state->boat_undone;
l->rem = l->visits[l->n_visits++].rem;