From 6a5cc149d373354941d046d3b3d851901fb4caf3 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 16 May 2022 01:34:54 -0700 Subject: 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. --- web/web_prompt.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'web/web_prompt.c') 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(); } -- cgit v1.2.3-70-g09d2