diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-15 01:18:36 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-15 01:18:36 -0700 |
commit | eda5d1668dbc8529453b7128c4ec2d51aeb1e783 (patch) | |
tree | 2ee5072865a761c540be454abcb6871358be65ea /match.c | |
parent | 3ffb56f167a1855731b50eebfc484b7cc5f21036 (diff) | |
download | dartboat-eda5d1668dbc8529453b7128c4ec2d51aeb1e783.tar.gz dartboat-eda5d1668dbc8529453b7128c4ec2d51aeb1e783.tar.xz |
split code into multiple files
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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); +} |