Fix some border drawing issues.
[sgt/puzzles] / solo.c
diff --git a/solo.c b/solo.c
index efd795b..19d91b4 100644 (file)
--- a/solo.c
+++ b/solo.c
@@ -331,8 +331,8 @@ static char *validate_params(game_params *params, int full)
        return "Both dimensions must be at least 2";
     if (params->c > ORDER_MAX || params->r > ORDER_MAX)
        return "Dimensions greater than "STR(ORDER_MAX)" are not supported";
-    if ((params->c * params->r) > 36)
-        return "Unable to support more than 36 distinct symbols in a puzzle";
+    if ((params->c * params->r) > 35)
+        return "Unable to support more than 35 distinct symbols in a puzzle";
     return NULL;
 }
 
@@ -2220,7 +2220,7 @@ static char *new_game_desc(game_params *params, random_state *rs,
                 grid2[coords[2*j+1]*cr+coords[2*j]] = 0;
 
             ret = solver(c, r, grid2, maxdiff);
-            if (ret != DIFF_IMPOSSIBLE && ret != DIFF_AMBIGUOUS) {
+            if (ret <= maxdiff) {
                 for (j = 0; j < ncoords; j++)
                     grid[coords[2*j+1]*cr+coords[2*j]] = 0;
             }
@@ -2293,6 +2293,9 @@ static char *validate_desc(game_params *params, char *desc)
         } else if (n == '_') {
             /* do nothing */;
         } else if (n > '0' && n <= '9') {
+            int val = atoi(desc-1);
+            if (val < 1 || val > params->c * params->r)
+                return "Out-of-range number in game description";
             squares++;
             while (*desc >= '0' && *desc <= '9')
                 desc++;
@@ -2709,7 +2712,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds,
     ds->tilesize = tilesize;
 }
 
-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);
 
@@ -2977,11 +2980,6 @@ static float game_flash_length(game_state *oldstate, game_state *newstate,
     return 0.0F;
 }
 
-static int game_wants_statusbar(void)
-{
-    return FALSE;
-}
-
 static int game_timing_state(game_state *state, game_ui *ui)
 {
     return TRUE;
@@ -3009,7 +3007,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
 
     /* Ick: fake up `ds->tilesize' for macro expansion purposes */
     game_drawstate ads, *ds = &ads;
-    ads.tilesize = tilesize;
+    game_set_size(dr, ds, NULL, tilesize);
 
     /*
      * Border.
@@ -3054,7 +3052,7 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
 #endif
 
 const struct game thegame = {
-    "Solo", "games.solo",
+    "Solo", "games.solo", "solo",
     default_params,
     game_fetch_preset,
     decode_params,
@@ -3085,9 +3083,9 @@ const struct game thegame = {
     game_anim_length,
     game_flash_length,
     TRUE, FALSE, game_print_size, game_print,
-    game_wants_statusbar,
+    FALSE,                            /* wants_statusbar */
     FALSE, game_timing_state,
-    0,                                /* mouse_priorities */
+    REQUIRE_RBUTTON | REQUIRE_NUMPAD,  /* flags */
 };
 
 #ifdef STANDALONE_SOLVER