summaryrefslogtreecommitdiff
path: root/web/web_match.c
blob: b3e8243b4e7a0c818ce0a9a2d7c3142b3b362b6e (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
#include "web_match.h"

#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>

struct match_state *state;
struct match_opts *match_opts;

void free_state()
{
	state->legs[1]->n_visits += state->boat_undone; // avoid memory leak
	leg_free(state->legs[0]);
	leg_free(state->legs[1]);
	free(state);
	state = NULL;
}

void match_opts_free()
{
	free(match_opts);
	match_opts = NULL;
}

bool match_is_over()
{
	return state->legs[0]->rem <= 0 || state->legs[1]->rem <= 0;
}