summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-15 01:18:36 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-15 01:18:36 -0700
commiteda5d1668dbc8529453b7128c4ec2d51aeb1e783 (patch)
tree2ee5072865a761c540be454abcb6871358be65ea /match.c
parent3ffb56f167a1855731b50eebfc484b7cc5f21036 (diff)
downloaddartboat-eda5d1668dbc8529453b7128c4ec2d51aeb1e783.tar.gz
dartboat-eda5d1668dbc8529453b7128c4ec2d51aeb1e783.tar.xz
split code into multiple files
Diffstat (limited to 'match.c')
-rw-r--r--match.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/match.c b/match.c
new file mode 100644
index 0000000..17ce3b1
--- /dev/null
+++ b/match.c
@@ -0,0 +1,22 @@
+#include "match.h"
+
+#include <stdlib.h>
+
+struct leg *leg_init(int points, char *name)
+{
+ struct leg *l = calloc(1, sizeof(*l));
+ l->name = name;
+ l->start = l->rem = points;
+ l->visits = calloc(1000, sizeof(*(l->visits))); // FIXME
+
+ return l;
+}
+
+void leg_free(struct leg *l)
+{
+ for (int i = 0; i < l->n_visits; ++i)
+ if (l->visits[i].darts)
+ free(l->visits[i].darts);
+ free(l->visits);
+ free(l);
+}