Fix warnings generated by gcc 4.6.0 about variables set but not
[sgt/puzzles] / mines.c
diff --git a/mines.c b/mines.c
index af6aa44..80d2337 100644 (file)
--- a/mines.c
+++ b/mines.c
@@ -2170,7 +2170,7 @@ static int open_square(game_state *state, int x, int y)
 static game_state *new_game(midend *me, game_params *params, char *desc)
 {
     game_state *state = snew(game_state);
-    int i, wh, x, y, ret, masked;
+    int i, wh, x, y, masked;
     unsigned char *bmp;
 
     state->w = params->w;
@@ -2265,7 +2265,7 @@ static game_state *new_game(midend *me, game_params *params, char *desc)
        }
 
        if (x >= 0 && y >= 0)
-           ret = open_square(state, x, y);
+           open_square(state, x, y);
         sfree(bmp);
     }
 
@@ -2898,48 +2898,17 @@ static void draw_tile(drawing *dr, game_drawstate *ds,
        } else if (v >= 64) {
            /*
             * Mark a mine.
-            * 
-            * FIXME: this could be done better!
             */
-#if 0
-           draw_text(dr, x + TILE_SIZE / 2, y + TILE_SIZE / 2,
-                     FONT_VARIABLE, TILE_SIZE * 7 / 8,
-                     ALIGN_VCENTRE | ALIGN_HCENTRE,
-                     COL_MINE, "*");
-#else
            {
                int cx = x + TILE_SIZE / 2;
                int cy = y + TILE_SIZE / 2;
                int r = TILE_SIZE / 2 - 3;
-               int coords[4*5*2];
-               int xdx = 1, xdy = 0, ydx = 0, ydy = 1;
-               int tdx, tdy, i;
-
-               for (i = 0; i < 4*5*2; i += 5*2) {
-                   coords[i+2*0+0] = cx - r/6*xdx + r*4/5*ydx;
-                   coords[i+2*0+1] = cy - r/6*xdy + r*4/5*ydy;
-                   coords[i+2*1+0] = cx - r/6*xdx + r*ydx;
-                   coords[i+2*1+1] = cy - r/6*xdy + r*ydy;
-                   coords[i+2*2+0] = cx + r/6*xdx + r*ydx;
-                   coords[i+2*2+1] = cy + r/6*xdy + r*ydy;
-                   coords[i+2*3+0] = cx + r/6*xdx + r*4/5*ydx;
-                   coords[i+2*3+1] = cy + r/6*xdy + r*4/5*ydy;
-                   coords[i+2*4+0] = cx + r*3/5*xdx + r*3/5*ydx;
-                   coords[i+2*4+1] = cy + r*3/5*xdy + r*3/5*ydy;
-
-                   tdx = ydx;
-                   tdy = ydy;
-                   ydx = xdx;
-                   ydy = xdy;
-                   xdx = -tdx;
-                   xdy = -tdy;
-               }
-
-               draw_polygon(dr, coords, 5*4, COL_MINE, COL_MINE);
 
+               draw_circle(dr, cx, cy, 5*r/6, COL_MINE, COL_MINE);
+               draw_rect(dr, cx - r/6, cy - r, 2*(r/6)+1, 2*r+1, COL_MINE);
+               draw_rect(dr, cx - r, cy - r/6, 2*r+1, 2*(r/6)+1, COL_MINE);
                draw_rect(dr, cx-r/3, cy-r/3, r/3, r/4, COL_HIGHLIGHT);
            }
-#endif
 
            if (v == 66) {
                /*
@@ -3115,6 +3084,11 @@ static float game_flash_length(game_state *oldstate, game_state *newstate,
     return 0.0F;
 }
 
+static int game_is_solved(game_state *state)
+{
+    return state->won;
+}
+
 static int game_timing_state(game_state *state, game_ui *ui)
 {
     if (state->dead || state->won || ui->completed || !state->layout->mines)
@@ -3165,6 +3139,7 @@ const struct game thegame = {
     game_redraw,
     game_anim_length,
     game_flash_length,
+    game_is_solved,
     FALSE, FALSE, game_print_size, game_print,
     TRUE,                             /* wants_statusbar */
     TRUE, game_timing_state,