~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Memory leak fixes from Jonas Koelker.
[sgt/puzzles]
/
unfinished
/
slide.c
diff --git
a/unfinished/slide.c
b/unfinished/slide.c
index
84639ed
..
634c5de
100644
(file)
--- a/
unfinished/slide.c
+++ b/
unfinished/slide.c
@@
-651,7
+651,7
@@
static void generate_board(int w, int h, int *rtx, int *rty, int *minmoves,
int *list, nlist, pos;
int tx, ty;
int i, j;
int *list, nlist, pos;
int tx, ty;
int i, j;
- int moves
;
+ int moves
= 0; /* placate optimiser */
/*
* Set up a board and fill it with singletons, except for a
/*
* Set up a board and fill it with singletons, except for a
@@
-821,6
+821,9
@@
static void generate_board(int w, int h, int *rtx, int *rty, int *minmoves,
}
}
}
}
+ sfree(dsf);
+ sfree(list);
+ sfree(tried_merge);
sfree(board2);
*rtx = tx;
sfree(board2);
*rtx = tx;
@@
-1166,6
+1169,11
@@
static char *solve_game(game_state *state, game_state *currstate,
return ret;
}
return ret;
}
+static int game_can_format_as_text_now(game_params *params)
+{
+ return TRUE;
+}
+
static char *game_text_format(game_state *state)
{
return board_text_format(state->w, state->h, state->board,
static char *game_text_format(game_state *state)
{
return board_text_format(state->w, state->h, state->board,
@@
-1592,7
+1600,8
@@
static void game_compute_size(game_params *params, int tilesize,
int *x, int *y)
{
/* fool the macros */
int *x, int *y)
{
/* fool the macros */
- struct dummy { int tilesize; } dummy = { tilesize }, *ds = &dummy;
+ struct dummy { int tilesize; } dummy, *ds = &dummy;
+ dummy.tilesize = tilesize;
*x = params->w * TILESIZE + 2*BORDER;
*y = params->h * TILESIZE + 2*BORDER;
*x = params->w * TILESIZE + 2*BORDER;
*y = params->h * TILESIZE + 2*BORDER;
@@
-2298,7
+2307,7
@@
static void game_print(drawing *dr, game_state *state, int tilesize)
}
#ifdef COMBINED
}
#ifdef COMBINED
-#define thegame
nullgam
e
+#define thegame
slid
e
#endif
const struct game thegame = {
#endif
const struct game thegame = {
@@
-2317,7
+2326,7
@@
const struct game thegame = {
dup_game,
free_game,
TRUE, solve_game,
dup_game,
free_game,
TRUE, solve_game,
- TRUE, game_text_format,
+ TRUE, game_
can_format_as_text_now, game_
text_format,
new_ui,
free_ui,
encode_ui,
new_ui,
free_ui,
encode_ui,