~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
And update makedist.sh to put all the new stuff into the source
[sgt/puzzles]
/
bridges.c
diff --git
a/bridges.c
b/bridges.c
index
721d75f
..
a8fd8b3
100644
(file)
--- a/
bridges.c
+++ b/
bridges.c
@@
-1012,7
+1012,7
@@
static int grid_degree(game_state *state, int x, int y, int *nx_r, int *ny_r)
static int map_hasloops(game_state *state, int mark)
{
static int map_hasloops(game_state *state, int mark)
{
- int x, y, ox, oy, nx
, ny
, loop = 0;
+ int x, y, ox, oy, nx
= 0, ny = 0
, loop = 0;
memcpy(state->scratch, state->grid, GRIDSZ(state));
memcpy(state->scratch, state->grid, GRIDSZ(state));
@@
-1064,8
+1064,7
@@
static void map_group(game_state *state)
struct island *is, *is_join;
/* Initialise dsf. */
struct island *is, *is_join;
/* Initialise dsf. */
- for (i = 0; i < wh; i++)
- dsf[i] = i;
+ dsf_init(dsf, wh);
/* For each island, find connected islands right or down
* and merge the dsf for the island squares as well as the
/* For each island, find connected islands right or down
* and merge the dsf for the island squares as well as the
@@
-1602,9
+1601,8
@@
static game_state *new_state(game_params *params)
ret->solved = ret->completed = 0;
ret->solver = snew(struct solver_state);
ret->solved = ret->completed = 0;
ret->solver = snew(struct solver_state);
- ret->solver->dsf = snew
n(wh, int
);
+ ret->solver->dsf = snew
_dsf(wh
);
ret->solver->tmpdsf = snewn(wh, int);
ret->solver->tmpdsf = snewn(wh, int);
- for (i = 0; i < wh; i++) ret->solver->dsf[i] = i;
ret->solver->refcount = 1;
ret->solver->refcount = 1;
@@
-1800,11
+1798,11
@@
generated:
echeck = 0;
for (x = 0; x < params->w; x++) {
if (INDEX(tobuild, gridi, x, 0)) echeck |= 1;
echeck = 0;
for (x = 0; x < params->w; x++) {
if (INDEX(tobuild, gridi, x, 0)) echeck |= 1;
- if (INDEX(tobuild, gridi, x, params->
w
-1)) echeck |= 2;
+ if (INDEX(tobuild, gridi, x, params->
h
-1)) echeck |= 2;
}
for (y = 0; y < params->h; y++) {
if (INDEX(tobuild, gridi, 0, y)) echeck |= 4;
}
for (y = 0; y < params->h; y++) {
if (INDEX(tobuild, gridi, 0, y)) echeck |= 4;
- if (INDEX(tobuild, gridi, params->
h
-1, y)) echeck |= 8;
+ if (INDEX(tobuild, gridi, params->
w
-1, y)) echeck |= 8;
}
if (echeck != 15) {
debug(("Generated grid doesn't fill to sides, retrying.\n"));
}
if (echeck != 15) {
debug(("Generated grid doesn't fill to sides, retrying.\n"));
@@
-2401,9
+2399,9
@@
static void lines_redraw(drawing *dr,
draw_update(dr, ox, oy, TILE_SIZE, TILE_SIZE);
}
draw_update(dr, ox, oy, TILE_SIZE, TILE_SIZE);
}
-#define ISLAND_RADIUS ((TILE_SIZE*1
3
)/20)
+#define ISLAND_RADIUS ((TILE_SIZE*1
2
)/20)
#define ISLAND_NUMSIZE(is) \
#define ISLAND_NUMSIZE(is) \
- (((is)->count < 10) ?
TILE_SIZE : (TILE_SIZE*8
)/10)
+ (((is)->count < 10) ?
(TILE_SIZE*7)/10 : (TILE_SIZE*5
)/10)
static void island_redraw(drawing *dr,
game_state *state, game_drawstate *ds,
static void island_redraw(drawing *dr,
game_state *state, game_drawstate *ds,
@@
-2631,7
+2629,7
@@
static void game_print(drawing *dr, game_state *state, int ts)
#endif
const struct game thegame = {
#endif
const struct game thegame = {
- "Bridges", "games.bridges",
+ "Bridges", "games.bridges",
"bridges",
default_params,
game_fetch_preset,
decode_params,
default_params,
game_fetch_preset,
decode_params,