From ee146e45b9ccc7f3b5dfd34973df538a42772b84 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 23 May 2022 15:50:36 -0700 Subject: store starting player as part of match data --- match.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'match.c') 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); -- cgit v1.2.3-70-g09d2