From d4a44af5efa5d3847a4ec4c545d585770e92e4b9 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 18 May 2022 17:56:31 -0700 Subject: web: remove assumption that comp is player 2 --- web/web_control.c | 15 +++++++-------- 1 file 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; -- cgit v1.2.3-70-g09d2