summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/dartboat_wasm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c
index 200621e..e624c67 100644
--- a/web/dartboat_wasm.c
+++ b/web/dartboat_wasm.c
@@ -258,7 +258,8 @@ EMSCRIPTEN_KEEPALIVE bool user_undo() {
EM_ASM({updatePlayerAvg($0, $1)}, P_USER,
l->n_visits ? (double)(l->start-l->rem)/l->n_visits : 0);
EM_ASM({updatePlayerAvg($0, $1)}, P_BOAT,
- state->l2->n_visits ? (double)(state->l2->start-state->l2->rem)/state->l2->n_visits : 0);
+ state->l2->n_visits ?
+ (double)(state->l2->start-state->l2->rem)/state->l2->n_visits : 0);
update_user_rem(l->rem);
update_boat_rem(state->l2->rem);
@@ -274,7 +275,8 @@ EMSCRIPTEN_KEEPALIVE void draw_boat_throwing(int pts, char *str) {
char buf[10];
sprintf(buf, "%d", pts);
- int rem = state->l2->n_visits > 1 ? state->l2->visits[state->l2->n_visits-2].rem : state->l2->start;
+ int rem = state->l2->n_visits > 1 ?
+ state->l2->visits[state->l2->n_visits-2].rem : state->l2->start;
update_boat_rem(rem - pts);
EM_ASM({setPromptInput($0)}, buf);
@@ -323,6 +325,7 @@ void init_boat() {
EMSCRIPTEN_KEEPALIVE void free_match() {
leg_free(state->l1);
+ state->l2->n_visits += undone_count; // FIXME messy way to avoid memory leak
leg_free(state->l2);
free(state);
state = NULL;