summaryrefslogtreecommitdiff
path: root/web/dartboat_wasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r--web/dartboat_wasm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c
index 006ec1e..5aa38bc 100644
--- a/web/dartboat_wasm.c
+++ b/web/dartboat_wasm.c
@@ -274,13 +274,17 @@ EMSCRIPTEN_KEEPALIVE bool user_undo() {
return false;
}
- if (state->mode == M_PVP)
- switch_active_user();
+ if (state->mode == M_PVP) {
+ if (is_match_over())
+ EM_ASM({setPlayerActive($0)}, state->active_p);
+ else
+ switch_active_user();
+ }
struct leg *l = state->active_l;
struct visit *v = l->visits + --l->n_visits;
l->rem += v->points;
- if (state->mode == M_PVC) {
+ if (state->mode == M_PVC && state->l2->n_visits > l->n_visits) {
state->l2->rem += state->l2->visits[--state->l2->n_visits].points;
++state->undone_count;
}
@@ -297,6 +301,8 @@ EMSCRIPTEN_KEEPALIVE bool user_undo() {
memcpy(v, 0, sizeof(*v));
EM_ASM({clearVisits()});
+ EM_ASM({promptMsgR($0)}, "");
+ EM_ASM({setPromptHandler($0)}, "visit");
draw_match();
return true;