mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Patches from James H. The usual stuff (memory leak fixes and 16-bit
cleanliness), plus he's enlarged the pencil-mark circles from TILESIZE/8 to TILESIZE/7. Makes no difference at all (thanks to integer division) when TILESIZE is the default of 20, but presumably helps at some other tile sizes. Fine by me. [originally from svn r6265]
This commit is contained in:
13
map.c
13
map.c
@ -2169,6 +2169,7 @@ static void free_game(game_state *state)
|
|||||||
sfree(state->map->regiony);
|
sfree(state->map->regiony);
|
||||||
sfree(state->map);
|
sfree(state->map);
|
||||||
}
|
}
|
||||||
|
sfree(state->pencil);
|
||||||
sfree(state->colouring);
|
sfree(state->colouring);
|
||||||
sfree(state);
|
sfree(state);
|
||||||
}
|
}
|
||||||
@ -2606,11 +2607,11 @@ static void draw_error(drawing *dr, game_drawstate *ds, int x, int y)
|
|||||||
|
|
||||||
static void draw_square(drawing *dr, game_drawstate *ds,
|
static void draw_square(drawing *dr, game_drawstate *ds,
|
||||||
game_params *params, struct map *map,
|
game_params *params, struct map *map,
|
||||||
int x, int y, int v)
|
int x, int y, unsigned long v)
|
||||||
{
|
{
|
||||||
int w = params->w, h = params->h, wh = w*h;
|
int w = params->w, h = params->h, wh = w*h;
|
||||||
int tv, bv, xo, yo, errs, pencil, i, j, oldj;
|
int tv, bv, xo, yo, i, j, oldj;
|
||||||
int show_numbers;
|
unsigned long errs, pencil, show_numbers;
|
||||||
|
|
||||||
errs = v & ERR_MASK;
|
errs = v & ERR_MASK;
|
||||||
v &= ~ERR_MASK;
|
v &= ~ERR_MASK;
|
||||||
@ -2679,7 +2680,7 @@ static void draw_square(drawing *dr, game_drawstate *ds,
|
|||||||
|
|
||||||
draw_circle(dr, COORD(x) + (xo+1)*TILESIZE/5,
|
draw_circle(dr, COORD(x) + (xo+1)*TILESIZE/5,
|
||||||
COORD(y) + (yo+1)*TILESIZE/5,
|
COORD(y) + (yo+1)*TILESIZE/5,
|
||||||
TILESIZE/8, COL_0 + c, COL_0 + c);
|
TILESIZE/7, COL_0 + c, COL_0 + c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2781,7 +2782,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
|
|||||||
for (x = 0; x < w; x++) {
|
for (x = 0; x < w; x++) {
|
||||||
int tv = state->colouring[state->map->map[TE * wh + y*w+x]];
|
int tv = state->colouring[state->map->map[TE * wh + y*w+x]];
|
||||||
int bv = state->colouring[state->map->map[BE * wh + y*w+x]];
|
int bv = state->colouring[state->map->map[BE * wh + y*w+x]];
|
||||||
int v;
|
unsigned long v;
|
||||||
|
|
||||||
if (tv < 0)
|
if (tv < 0)
|
||||||
tv = FOUR;
|
tv = FOUR;
|
||||||
@ -2864,7 +2865,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
|
|||||||
*/
|
*/
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
for (x = 0; x < w; x++) {
|
for (x = 0; x < w; x++) {
|
||||||
int v = ds->todraw[y*w+x];
|
unsigned long v = ds->todraw[y*w+x];
|
||||||
if (ds->drawn[y*w+x] != v) {
|
if (ds->drawn[y*w+x] != v) {
|
||||||
draw_square(dr, ds, &state->p, state->map, x, y, v);
|
draw_square(dr, ds, &state->p, state->map, x, y, v);
|
||||||
ds->drawn[y*w+x] = v;
|
ds->drawn[y*w+x] = v;
|
||||||
|
Reference in New Issue
Block a user