diff options
Diffstat (limited to 'web/web_control.c')
-rw-r--r-- | web/web_control.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/web/web_control.c b/web/web_control.c index fac1d8b..39b92ba 100644 --- a/web/web_control.c +++ b/web/web_control.c @@ -230,10 +230,22 @@ static void undo_active() state->active_leg = state->legs[state->active_player - 1]; } +static bool first_user_has_thrown() { + for (int i = 0, np = num_players(); i < np; ++i) { + int pn = match_opts->throws_first + i; + if (pn > np) + pn -= np; + + if (!player_is_comp(pn)) + return !!state->legs[pn - 1]->n_visits; + } + + return false; +} + void user_undo() { - // FIXME: undo doesn't work for first visit when player 2 throws first - if (!state->legs[0]->n_visits) { + if (!first_user_has_thrown()) { oi(); return; } |