mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Use game_set_size() to set up the temporary drawstate in
game_print(), wherever feasible. This fixes a specific bug in Loopy (James H's new field ds->linewidth wasn't being set up, leading to corrupted print output), but I've made the change in all affected files because it also seems like a generally good idea to encourage it for future games, to prevent other problems of this type. There is one slight snag, which is that Map _can't_ do this because its game_set_size() also initialises a blitter. I could fix this by abstracting the common parts of Map's game_set_size() out into a subfunction called by game_set_size() and also called directly by game_print(); alternatively, I could introduce a means of determining whether a `drawing *' was for screen or printing use. Not sure which yet. [originally from svn r6340]
This commit is contained in:
@ -1711,7 +1711,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
c = print_mono_colour(dr, 1); assert(c == COL_BACKGROUND);
|
c = print_mono_colour(dr, 1); assert(c == COL_BACKGROUND);
|
||||||
c = print_mono_colour(dr, 0); assert(c == COL_TEXT);
|
c = print_mono_colour(dr, 0); assert(c == COL_TEXT);
|
||||||
|
@ -2175,8 +2175,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
ds->crad = 3*(tilesize-1)/8;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
3
loopy.c
3
loopy.c
@ -2668,7 +2668,8 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
int ink = print_mono_colour(dr, 0);
|
int ink = print_mono_colour(dr, 0);
|
||||||
int x, y;
|
int x, y;
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ds->tilesize = tilesize;
|
|
||||||
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dots. I'll deliberately make the dots a bit wider than the
|
* Dots. I'll deliberately make the dots a bit wider than the
|
||||||
|
1
map.c
1
map.c
@ -2956,6 +2956,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
struct { int tilesize; } ads, *ds = &ads;
|
struct { int tilesize; } ads, *ds = &ads;
|
||||||
|
/* We can't call game_set_size() here because we don't want a blitter */
|
||||||
ads.tilesize = tilesize;
|
ads.tilesize = tilesize;
|
||||||
|
|
||||||
ink = print_mono_colour(dr, 0);
|
ink = print_mono_colour(dr, 0);
|
||||||
|
2
net.c
2
net.c
@ -2773,7 +2773,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
@ -1199,7 +1199,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
2
rect.c
2
rect.c
@ -2791,7 +2791,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
2
slant.c
2
slant.c
@ -2001,7 +2001,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
2
solo.c
2
solo.c
@ -3009,7 +3009,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
|
|||||||
|
|
||||||
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
|
||||||
game_drawstate ads, *ds = &ads;
|
game_drawstate ads, *ds = &ads;
|
||||||
ads.tilesize = tilesize;
|
game_set_size(dr, ds, NULL, tilesize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Border.
|
* Border.
|
||||||
|
Reference in New Issue
Block a user