From 0517dcffe7ac66b604143d9457ba6591d34ae07e Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 25 May 2022 02:49:40 -0700 Subject: curses: use suggested checkout function from lib --- dartboat.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/dartboat.c b/dartboat.c index 58cddfc..743c91b 100644 --- a/dartboat.c +++ b/dartboat.c @@ -7,6 +7,7 @@ #include #include #include +#include #include void test_match(int start_points) @@ -38,27 +39,12 @@ void user_visit(struct leg *l, char *name) char status[100]; int len = sprintf(status, " %s has %d remaining", name, l->rem); - if (l->rem <= 170) { - 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, ")"); - } + int len_co = checkouts_suggested(status + len + 2, l->rem, 3); + if (len_co) { + memcpy(status + len, " (", 2); + memcpy(status + len + 2 + len_co, ")", 2); } + char prompt[] = " enter points> "; curses_status(status); curses_prompt(prompt); -- cgit v1.2.3-70-g09d2