summaryrefslogtreecommitdiff
path: root/web/web_match.h
blob: 8f106fb640149e509f61ffd0dcd837173aacaabf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef WEB_MATCH_H
#define WEB_MATCH_H

#include "match.h"

enum match_mode {
	M_FIRST = 1,
	M_PVC = M_FIRST,
	M_P,
	M_PVP,
	M_LAST = M_PVP
};

struct match_state {
	enum match_mode mode;
	struct leg *legs[2];
	int active_player;
	int boat_undone;
	int num_darts;
};

struct match_opts {
	enum match_mode mode;
	char *p1_name, *p2_name;
	int start_pts;
	int throws_first;
};

extern struct match_state *state;
extern struct match_opts *match_opts;

void free_state();
void match_opts_free();

int match_num_players();
int match_winning_player();
bool match_is_over();

struct leg *state_active_leg();

#endif