From 5a1032e3e4b3479c84807d5610335c7e4f850158 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 18 May 2022 20:29:25 -0700 Subject: web: store comp info as part of match player info instead of globally This allows us things like two computer players against one another, which I've also added for testing. --- web/web_match.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'web/web_match.h') diff --git a/web/web_match.h b/web/web_match.h index ae5eff0..715be76 100644 --- a/web/web_match.h +++ b/web/web_match.h @@ -8,19 +8,31 @@ enum match_mode { M_PVC = M_FIRST, M_P, M_PVP, - M_LAST = M_PVP + M_CVC, + M_LAST = M_CVC +}; + +enum player_type { + PT_USER, + PT_COMP }; struct match_state { + int id; enum match_mode mode; - struct leg *legs[2]; + + struct leg **legs; + enum player_type *player_types; + int *comp_undone; + int num_players, size_players; + int active_player; - int boat_undone; int num_darts; }; struct match_opts { enum match_mode mode; + enum player_type p1_type, p2_type; char *p1_name, *p2_name; int start_pts; int throws_first; @@ -29,6 +41,8 @@ struct match_opts { extern struct match_state *state; extern struct match_opts *match_opts; +void match_new(); +void match_add_player(int start_pts, enum player_type type, char *name); void free_state(); void match_opts_free(); -- cgit v1.2.3-70-g09d2