~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweak the cropping of the Filling icon very slightly.
[sgt/puzzles]
/
map.c
diff --git
a/map.c
b/map.c
index
6ed9e14
..
098fc47
100644
(file)
--- a/
map.c
+++ b/
map.c
@@
-1695,8
+1695,7
@@
static char *parse_edge_list(game_params *params, char **desc, int *map)
int i, k, pos, state;
char *p = *desc;
int i, k, pos, state;
char *p = *desc;
- for (i = 0; i < wh; i++)
- map[wh+i] = i;
+ dsf_init(map+wh, wh);
pos = -1;
state = 0;
pos = -1;
state = 0;
@@
-1868,7
+1867,7
@@
static game_state *new_game(midend *me, game_params *params, char *desc)
* outlines by the judicious use of diagonally divided squares.
*/
{
* outlines by the judicious use of diagonally divided squares.
*/
{
- random_state *rs = random_
init
(desc, strlen(desc));
+ random_state *rs = random_
new
(desc, strlen(desc));
int *squares = snewn(wh, int);
int done_something;
int *squares = snewn(wh, int);
int done_something;
@@
-2169,6
+2168,7
@@
static void free_game(game_state *state)
sfree(state->map->regiony);
sfree(state->map);
}
sfree(state->map->regiony);
sfree(state->map);
}
+ sfree(state->pencil);
sfree(state->colouring);
sfree(state);
}
sfree(state->colouring);
sfree(state);
}
@@
-2239,7
+2239,15
@@
static char *game_text_format(game_state *state)
}
struct game_ui {
}
struct game_ui {
- int drag_colour; /* -1 means no drag active */
+ /*
+ * drag_colour:
+ *
+ * - -2 means no drag currently active.
+ * - >=0 means we're dragging a solid colour.
+ * - -1 means we're dragging a blank space, and drag_pencil
+ * might or might not add some pencil-mark stipples to that.
+ */
+ int drag_colour;
int drag_pencil;
int dragx, dragy;
int show_numbers;
int drag_pencil;
int dragx, dragy;
int show_numbers;
@@
-2504,8
+2512,7
@@
static void game_set_size(drawing *dr, game_drawstate *ds,
{
ds->tilesize = tilesize;
{
ds->tilesize = tilesize;
- if (ds->bl)
- blitter_free(dr, ds->bl);
+ assert(!ds->bl); /* set_size is never called twice */
ds->bl = blitter_new(dr, TILESIZE+3, TILESIZE+3);
}
ds->bl = blitter_new(dr, TILESIZE+3, TILESIZE+3);
}
@@
-2519,7
+2526,7
@@
const int map_hatching[FOUR] = {
HATCH_VERT, HATCH_SLASH, HATCH_HORIZ, HATCH_BACKSLASH
};
HATCH_VERT, HATCH_SLASH, HATCH_HORIZ, HATCH_BACKSLASH
};
-static float *game_colours(frontend *fe,
game_state *state,
int *ncolours)
+static float *game_colours(frontend *fe, int *ncolours)
{
float *ret = snewn(3 * NCOLOURS, float);
{
float *ret = snewn(3 * NCOLOURS, float);
@@
-2606,11
+2613,11
@@
static void draw_error(drawing *dr, game_drawstate *ds, int x, int y)
static void draw_square(drawing *dr, game_drawstate *ds,
game_params *params, struct map *map,
static void draw_square(drawing *dr, game_drawstate *ds,
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
show_numbers;
+ int tv, bv, xo, yo, i, j, oldj;
+
unsigned long errs, pencil,
show_numbers;
errs = v & ERR_MASK;
v &= ~ERR_MASK;
errs = v & ERR_MASK;
v &= ~ERR_MASK;
@@
-2679,7
+2686,7
@@
static void draw_square(drawing *dr, game_drawstate *ds,
draw_circle(dr, COORD(x) + (xo+1)*TILESIZE/5,
COORD(y) + (yo+1)*TILESIZE/5,
draw_circle(dr, COORD(x) + (xo+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
+2788,7
@@
static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
for (x = 0; x < 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]];
for (x = 0; x < 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
v;
+
unsigned long
v;
if (tv < 0)
tv = FOUR;
if (tv < 0)
tv = FOUR;
@@
-2864,7
+2871,7
@@
static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
*/
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
*/
for (y = 0; y < h; y++)
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) {
draw_square(dr, ds, &state->p, state->map, x, y, v);
ds->drawn[y*w+x] = v;
if (ds->drawn[y*w+x] != v) {
draw_square(dr, ds, &state->p, state->map, x, y, v);
ds->drawn[y*w+x] = v;
@@
-2915,11
+2922,6
@@
static float game_flash_length(game_state *oldstate, game_state *newstate,
return 0.0F;
}
return 0.0F;
}
-static int game_wants_statusbar(void)
-{
- return FALSE;
-}
-
static int game_timing_state(game_state *state, game_ui *ui)
{
return TRUE;
static int game_timing_state(game_state *state, game_ui *ui)
{
return TRUE;
@@
-2948,6
+2950,7
@@
static void game_print(drawing *dr, game_state *state, int tilesize)
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
struct { int tilesize; } ads, *ds = &ads;
/* Ick: fake up `ds->tilesize' for macro expansion purposes */
struct { int tilesize; } ads, *ds = &ads;
+ /* We can't call game_set_size() here because we don't want a blitter */
ads.tilesize = tilesize;
ink = print_mono_colour(dr, 0);
ads.tilesize = tilesize;
ink = print_mono_colour(dr, 0);
@@
-3081,7
+3084,7
@@
static void game_print(drawing *dr, game_state *state, int tilesize)
#endif
const struct game thegame = {
#endif
const struct game thegame = {
- "Map", "games.map",
+ "Map", "games.map",
"map",
default_params,
game_fetch_preset,
decode_params,
default_params,
game_fetch_preset,
decode_params,
@@
-3112,9
+3115,9
@@
const struct game thegame = {
game_anim_length,
game_flash_length,
TRUE, TRUE, game_print_size, game_print,
game_anim_length,
game_flash_length,
TRUE, TRUE, game_print_size, game_print,
- game_wants_statusbar,
+ FALSE, /* wants_statusbar */
FALSE, game_timing_state,
FALSE, game_timing_state,
- 0, /*
mouse_prioritie
s */
+ 0, /*
flag
s */
};
#ifdef STANDALONE_SOLVER
};
#ifdef STANDALONE_SOLVER