summaryrefslogtreecommitdiff
path: root/web/web_match.h
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 20:29:25 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-18 20:30:17 -0700
commit5a1032e3e4b3479c84807d5610335c7e4f850158 (patch)
tree045b26df714e44c270f428daea2e83bc4b2e3b1a /web/web_match.h
parentd4a44af5efa5d3847a4ec4c545d585770e92e4b9 (diff)
downloaddartboat-5a1032e3e4b3479c84807d5610335c7e4f850158.tar.gz
dartboat-5a1032e3e4b3479c84807d5610335c7e4f850158.tar.xz
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.
Diffstat (limited to 'web/web_match.h')
-rw-r--r--web/web_match.h20
1 files changed, 17 insertions, 3 deletions
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();