From 20e84c488231171ad9dfb35d833c3c6b10f37abd Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 11 Apr 2022 17:25:56 -0700 Subject: suggest checkout --- dartbot.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'dartbot.c') diff --git a/dartbot.c b/dartbot.c index ae64b7f..77681ae 100644 --- a/dartbot.c +++ b/dartbot.c @@ -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); -- cgit v1.2.3-70-g09d2