X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/736417dcfcf5cfc6b6edb37788318d23f8a58f3b..0968d748f157ecce4155b255ff98fa909c325bd9:/galaxies.c diff --git a/galaxies.c b/galaxies.c index 32cdf00..6989fe3 100644 --- a/galaxies.c +++ b/galaxies.c @@ -298,8 +298,8 @@ static void add_assoc(game_state *state, space *tile, space *dot) { tile->dotx = dot->x; tile->doty = dot->y; dot->nassoc++; - debug(("add_assoc sp %d %d --> dot %d,%d, new nassoc %d.\n", - tile->x, tile->y, dot->x, dot->y, dot->nassoc)); + /*debug(("add_assoc sp %d %d --> dot %d,%d, new nassoc %d.\n", + tile->x, tile->y, dot->x, dot->y, dot->nassoc));*/ } static struct space *sp2dot(game_state *state, int x, int y) @@ -1216,8 +1216,8 @@ generate: clear_game(state, 1); ntries++; - //generate_pass(state, rs, scratch, 10, GP_DOTS); - //generate_pass(state, rs, scratch, 100, 0); + /* generate_pass(state, rs, scratch, 10, GP_DOTS); */ + /* generate_pass(state, rs, scratch, 100, 0); */ generate_pass(state, rs, scratch, 100, GP_DOTS); game_update_dots(state); @@ -2205,7 +2205,7 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, solver_obvious(tmp); else solver_state(tmp, DIFF_UNREASONABLE-1); - ret = diff_game(state, tmp, 0); + ret = diff_game(state, tmp, 1); free_game(tmp); return ret; } @@ -2225,8 +2225,8 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, } else if (button == RIGHT_BUTTON) { int px1, py1; - px = 2*FROMCOORD((float)x) + 0.5; - py = 2*FROMCOORD((float)y) + 0.5; + px = (int)(2*FROMCOORD((float)x) + 0.5); + py = (int)(2*FROMCOORD((float)y) + 0.5); dot = NULL; @@ -2245,8 +2245,8 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds, * Found a dot. Begin a drag from it. */ dot = &SPACE(state, px1, py1); - ui->srcx = px; - ui->srcy = py; + ui->srcx = px1; + ui->srcy = py1; goto done; /* multi-level break */ } } @@ -2594,6 +2594,7 @@ static game_state *execute_move(game_state *state, char *move) #endif } else if (c == 'S') { move++; + ret->used_solve = 1; } else goto badmove; @@ -2758,13 +2759,13 @@ static void game_free_drawstate(drawing *dr, game_drawstate *ds) static void draw_arrow(drawing *dr, game_drawstate *ds, int cx, int cy, int ddx, int ddy) { - float vlen = sqrt(ddx*ddx+ddy*ddy); + float vlen = (float)sqrt(ddx*ddx+ddy*ddy); float xdx = ddx/vlen, xdy = ddy/vlen; float ydx = -xdy, ydy = xdx; - int e1x = cx + xdx*TILE_SIZE/3, e1y = cy + xdy*TILE_SIZE/3; - int e2x = cx - xdx*TILE_SIZE/3, e2y = cy - xdy*TILE_SIZE/3; - int adx = (ydx-xdx)*TILE_SIZE/8, ady = (ydy-xdy)*TILE_SIZE/8; - int adx2 = (-ydx-xdx)*TILE_SIZE/8, ady2 = (-ydy-xdy)*TILE_SIZE/8; + int e1x = cx + (int)(xdx*TILE_SIZE/3), e1y = cy + (int)(xdy*TILE_SIZE/3); + int e2x = cx - (int)(xdx*TILE_SIZE/3), e2y = cy - (int)(xdy*TILE_SIZE/3); + int adx = (int)((ydx-xdx)*TILE_SIZE/8), ady = (int)((ydy-xdy)*TILE_SIZE/8); + int adx2 = (int)((-ydx-xdx)*TILE_SIZE/8), ady2 = (int)((-ydy-xdy)*TILE_SIZE/8); draw_line(dr, e1x, e1y, e2x, e2y, COL_ARROW); draw_line(dr, e1x, e1y, e1x+adx, e1y+ady, COL_ARROW); @@ -3176,7 +3177,7 @@ static void game_print(drawing *dr, game_state *state, int sz) for (y = 0; y <= 2*h; y++) for (x = 0; x <= 2*w; x++) if (SPACE(state, x, y).flags & F_DOT) { - draw_circle(dr, COORD(x/2.0), COORD(y/2.0), DOT_SIZE, + draw_circle(dr, (int)COORD(x/2.0), (int)COORD(y/2.0), DOT_SIZE, (SPACE(state, x, y).flags & F_DOT_BLACK ? black : white), black); } @@ -3230,11 +3231,11 @@ const struct game thegame = { FALSE, FALSE, NULL, NULL, TRUE, /* wants_statusbar */ #else - TRUE, TRUE, game_print_size, game_print, + TRUE, FALSE, game_print_size, game_print, FALSE, /* wants_statusbar */ #endif FALSE, game_timing_state, - 0, /* flags */ + REQUIRE_RBUTTON, /* flags */ }; #ifdef STANDALONE_SOLVER