summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-23 15:50:36 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-23 15:54:12 -0700
commitee146e45b9ccc7f3b5dfd34973df538a42772b84 (patch)
tree3b91beb43a2cac1ad16eefa43b21c6d991d49ac1 /match.c
parent15ff00e056a98ab4210dde3d4461a88849d6c1d4 (diff)
downloaddartboat-ee146e45b9ccc7f3b5dfd34973df538a42772b84.tar.gz
dartboat-ee146e45b9ccc7f3b5dfd34973df538a42772b84.tar.xz
store starting player as part of match data
Diffstat (limited to 'match.c')
-rw-r--r--match.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/match.c b/match.c
index 03e91fd..0b9a425 100644
--- a/match.c
+++ b/match.c
@@ -85,7 +85,10 @@ void match_add_player(struct match *m, enum player_type type, char *name,
{
if (m->n_players == m->size_players)
match_grow_players(m);
+
int i = m->n_players++;
+ if (!m->starting_player)
+ m->starting_player = i;
struct player *p = m->players + i;
p->type = type;
@@ -110,7 +113,7 @@ int match_prev_player(struct match *m)
return m->active_player - 1;
}
-int match_last_player_to_throw(struct match *m)
+int match_prev_throw_player(struct match *m)
{
int p = match_winning_player(m);
return p ? p : match_prev_player(m);