summaryrefslogtreecommitdiff
path: root/dartboat.c
diff options
context:
space:
mode:
Diffstat (limited to 'dartboat.c')
-rw-r--r--dartboat.c26
1 files 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 <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
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);