diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-11 17:25:56 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-11 17:25:56 -0700 |
commit | 20e84c488231171ad9dfb35d833c3c6b10f37abd (patch) | |
tree | b92c74371b7c8107b6a62b3e8c65808d1b5936cd | |
parent | 0e49915f3bb4e12656eda150a44649de83ace440 (diff) | |
download | dartboat-20e84c488231171ad9dfb35d833c3c6b10f37abd.tar.gz dartboat-20e84c488231171ad9dfb35d833c3c6b10f37abd.tar.xz |
suggest checkout
-rw-r--r-- | dartbot.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -376,7 +376,23 @@ void user_visit(struct leg *l) struct visit *v = l->visits + l->n_visits++; char status[100]; - sprintf(status, "%d remaining", l->rem); + int len = sprintf(status, "%d remaining", l->rem); + char *target = CHECKOUTS[2][l->rem-1]; + if (target) { + int trem = l->rem - segment_points(segment_from_name(target)); + len += sprintf(status + len, " (%s", target); + if (trem) { + target = CHECKOUTS[1][trem-1]; + len += sprintf(status + len, "-%s", target); + trem = trem - segment_points(segment_from_name(target)); + + if (trem) { + target = CHECKOUTS[0][trem-1]; + len += sprintf(status + len, "-%s", target); + } + } + len += sprintf(status + len, ")"); + } char prompt[] = "enter points> "; curses_status(status); curses_prompt(prompt); |