summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-24 01:10:22 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-24 01:10:22 -0700
commit3aa490e9cce29fd3d95eb0ce57b9744b3ed26516 (patch)
treeabec3b30d4c1dab47c131ed5cb0c37458fbe3bfd
parent6d8ae1a15e5c7012529b556b8a4d47e295a70b8a (diff)
downloaddartboat-3aa490e9cce29fd3d95eb0ce57b9744b3ed26516.tar.gz
dartboat-3aa490e9cce29fd3d95eb0ce57b9744b3ed26516.tar.xz
web: clear match display after match is over
-rw-r--r--web/dartboat_wasm.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c
index d18cd12..836c87f 100644
--- a/web/dartboat_wasm.c
+++ b/web/dartboat_wasm.c
@@ -85,12 +85,6 @@ void match_over() {
EM_ASM(setPlayerActive());
}
-EMSCRIPTEN_KEEPALIVE void match_init() {
- EM_ASM({setPromptHandler($0)}, "init");
- EM_ASM({promptMsgR($0)}, "");
- EM_ASM({promptMsgL($0)}, "Select match mode:");
-}
-
EMSCRIPTEN_KEEPALIVE void draw_match() {
struct leg *l1 = state->l1;
struct leg *l2 = state->l2;
@@ -371,6 +365,20 @@ EMSCRIPTEN_KEEPALIVE void free_match() {
state = NULL;
}
+EMSCRIPTEN_KEEPALIVE void match_init() {
+ for (int i = 1; i < 3; ++i) {
+ EM_ASM({updatePlayerName($0, $1)}, i, "");
+ EM_ASM({updatePlayerRem($0, $1)}, i, "");
+ EM_ASM({updatePlayerSugg($0, $1)}, i, "");
+ EM_ASM({updatePlayerAvg($0, $1)}, i, 0);
+ }
+ EM_ASM(clearVisits());
+
+ EM_ASM({setPromptHandler($0)}, "init");
+ EM_ASM({promptMsgR($0)}, "");
+ EM_ASM({promptMsgL($0)}, "Select match mode:");
+}
+
EMSCRIPTEN_KEEPALIVE void start_match(int mode) {
if (mode != M_PVP && mode != M_PVC && mode != M_P) {
EM_ASM(oi());