diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-16 01:34:54 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-16 01:36:56 -0700 |
commit | 6a5cc149d373354941d046d3b3d851901fb4caf3 (patch) | |
tree | 773e7fd7135c50cd126eef34d720dcfe64f3a4e7 /web/web_prompt.c | |
parent | 72fa8e2849ab618fa66b776fd4af6d18d025fd51 (diff) | |
download | dartboat-6a5cc149d373354941d046d3b3d851901fb4caf3.tar.gz dartboat-6a5cc149d373354941d046d3b3d851901fb4caf3.tar.xz |
web: support ending ongoing match; ui/colour tweaks
Ending a match while the computer is throwing currently results in data
being written to the prompt because any scheduled C calls are not being
cleared yet.
Diffstat (limited to 'web/web_prompt.c')
-rw-r--r-- | web/web_prompt.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/web/web_prompt.c b/web/web_prompt.c index f2aaa68..edb9f99 100644 --- a/web/web_prompt.c +++ b/web/web_prompt.c @@ -166,7 +166,7 @@ void prompt_num_darts() void prompt_end_match() { - scoreboard_set_player_active(-1); // sets all inactive + scoreboard_set_player_active(-1); set_prompt_mode(PM_END_MATCH); prompt_set_msgl( @@ -346,6 +346,9 @@ void prompt_handle_pre(char *command) if (pm == PM_END_MATCH && strcmp(command, "submit")) deactivate_key("submit"); + + if (strcmp(command, "exit")) + deactivate_key("exit"); } void prompt_handle_on_change() @@ -473,6 +476,16 @@ void prompt_handle_undo() toggle_key("undo"); } +void prompt_handle_exit() +{ + if (key_is_active("exit")) { + // FIXME clear scheduled c calls (comp throwing) + scoreboard_set_player_active(-1); + end_match(); + } + toggle_key("exit"); +} + EMSCRIPTEN_KEEPALIVE void prompt_handle(char *command, char *data) { @@ -490,4 +503,6 @@ void prompt_handle(char *command, char *data) prompt_handle_rem(); else if (!strcmp(command, "undo")) prompt_handle_undo(); + else if (!strcmp(command, "exit")) + prompt_handle_exit(); } |