summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-11 17:25:56 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-11 17:25:56 -0700
commit20e84c488231171ad9dfb35d833c3c6b10f37abd (patch)
treeb92c74371b7c8107b6a62b3e8c65808d1b5936cd
parent0e49915f3bb4e12656eda150a44649de83ace440 (diff)
downloaddartboat-20e84c488231171ad9dfb35d833c3c6b10f37abd.tar.gz
dartboat-20e84c488231171ad9dfb35d833c3c6b10f37abd.tar.xz
suggest checkout
-rw-r--r--dartbot.c18
1 files changed, 17 insertions, 1 deletions
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);