X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/cb0c7d4a682a68dfeb06e1c4e3aeb01cdf126c5e..6bb2af847d3bad4f2a544ad7a428f7063fd1991a:/inertia.c diff --git a/inertia.c b/inertia.c index 4e84f56..aebd314 100644 --- a/inertia.c +++ b/inertia.c @@ -1445,6 +1445,11 @@ static char *solve_game(game_state *state, game_state *currstate, return soln; } +static int game_can_format_as_text_now(game_params *params) +{ + return TRUE; +} + static char *game_text_format(game_state *state) { return NULL; @@ -1575,7 +1580,8 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, dir = 1; else if (button == (MOD_NUM_KEYPAD | '3')) dir = 3; - else if (button == ' ' && state->soln && state->solnpos < state->soln->len) + else if (IS_CURSOR_SELECT(button) && + state->soln && state->solnpos < state->soln->len) dir = state->soln->list[state->solnpos]; if (dir < 0) @@ -1626,6 +1632,10 @@ static game_state *execute_move(game_state *state, char *move) sol->list[i] = move[i] - '0'; ret = dup_game(state); ret->cheated = TRUE; + if (ret->soln && --ret->soln->refcount == 0) { + sfree(ret->soln->list); + sfree(ret->soln); + } ret->soln = sol; ret->solnpos = 0; sol->refcount = 1; @@ -2180,7 +2190,7 @@ const struct game thegame = { dup_game, free_game, TRUE, solve_game, - FALSE, game_text_format, + FALSE, game_can_format_as_text_now, game_text_format, new_ui, free_ui, encode_ui,