mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 15:41:30 -07:00
Pattern: fix crash when printing.
The mostly-unpopulated game_drawstate created in game_print for the sake of the TILE_SIZE macro was being passed to a subroutine which expected another field of it to be filled in. Rather than continue filling in one field at a time, let's just make a complete one.
This commit is contained in:
10
pattern.c
10
pattern.c
@ -2025,8 +2025,12 @@ static void game_print(drawing *dr, const game_state *state, const game_ui *ui,
|
||||
int ink = print_mono_colour(dr, 0);
|
||||
int x, y, i;
|
||||
|
||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||
game_drawstate ads, *ds = &ads;
|
||||
/*
|
||||
* Make a game_drawstate, so that the TILE_SIZE macro will work in
|
||||
* this function, and so that draw_numbers can use it to format
|
||||
* the text for numeric clues.
|
||||
*/
|
||||
game_drawstate *ds = game_new_drawstate(dr, state);
|
||||
game_set_size(dr, ds, NULL, tilesize);
|
||||
|
||||
/*
|
||||
@ -2070,6 +2074,8 @@ static void game_print(drawing *dr, const game_state *state, const game_ui *ui,
|
||||
TOCOORD(h, y) + TILE_SIZE/2,
|
||||
TILE_SIZE/12, ink, ink);
|
||||
}
|
||||
|
||||
game_free_drawstate(dr, ds);
|
||||
}
|
||||
|
||||
#ifdef COMBINED
|
||||
|
Reference in New Issue
Block a user