diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-24 16:42:19 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-24 16:42:19 -0700 |
commit | 14dd3ef4196af7c2269d80931dfcdcd1c3068857 (patch) | |
tree | 227592d4fac88d95dcdb31740798d6eec2bed126 /web/web_scoreboard.c | |
parent | 125ce0ef81d8d7d684a92c1c5366d5b38880d8fe (diff) | |
download | dartboat-14dd3ef4196af7c2269d80931dfcdcd1c3068857.tar.gz dartboat-14dd3ef4196af7c2269d80931dfcdcd1c3068857.tar.xz |
calculate suggested checkouts in lib code
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r-- | web/web_scoreboard.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index 657c326..35af7f4 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -176,18 +176,9 @@ void update_player_name(int pn, char *str) void update_player_sugg(int pn, int rem) { - char str[15] = {0}, *p = str; - - if (rem > 1 && rem <= 170) { - char *target; - int i = 3, trem = rem; - while (i && trem && (target = CHECKOUTS[--i][trem-1])) { - p += sprintf(p, i == 2 ? "%s" : "-%s", target); - trem -= segment_points(segment_from_name(target)); - } - } - - scoreboard_set_player_sugg(pn, str); + char *sugg = checkouts_suggested(rem); + scoreboard_set_player_sugg(pn, sugg ? sugg : ""); + free(sugg); } static double calc_avg(struct leg *l, int n_darts) { |