Add grotty casts to prevent negative -> large positive conversion of cursor
[sgt/puzzles] / rect.c
diff --git a/rect.c b/rect.c
index ab48e3c..06ccff6 100644 (file)
--- a/rect.c
+++ b/rect.c
@@ -403,9 +403,9 @@ char *new_game_seed(game_params *params, random_state *rs)
      * generate the base grid.
      */
     params2->w = params->w / (1.0F + params->expandfactor);
-    if (params2->w < 1) params2->w = 1;
-    params2->h = params->h * (1.0F + params->expandfactor);
-    if (params2->h < 1) params2->h = 1;
+    if (params2->w < 2 && params->w >= 2) params2->w = 2;
+    params2->h = params->h / (1.0F + params->expandfactor);
+    if (params2->h < 2 && params->h >= 2) params2->h = 2;
 
     grid = snewn(params2->w * params2->h, int);
 
@@ -881,7 +881,13 @@ char *new_game_seed(game_params *params, random_state *rs)
                     run -= c - ('a' - 1);
                 }
             } else {
-                *p++ = '_';
+                /*
+                 * If there's a number in the very top left or
+                 * bottom right, there's no point putting an
+                 * unnecessary _ before or after it.
+                 */
+                if (p > seed && n > 0)
+                    *p++ = '_';
             }
             if (n > 0)
                 p += sprintf(p, "%d", n);
@@ -1482,7 +1488,7 @@ void draw_tile(frontend *fe, game_state *state, int x, int y,
 }
 
 void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
-                 game_state *state, game_ui *ui,
+                 game_state *state, int dir, game_ui *ui,
                  float animtime, float flashtime)
 {
     int x, y;
@@ -1573,12 +1579,12 @@ void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
     sfree(correct);
 }
 
-float game_anim_length(game_state *oldstate, game_state *newstate)
+float game_anim_length(game_state *oldstate, game_state *newstate, int dir)
 {
     return 0.0F;
 }
 
-float game_flash_length(game_state *oldstate, game_state *newstate)
+float game_flash_length(game_state *oldstate, game_state *newstate, int dir)
 {
     if (!oldstate->completed && newstate->completed)
         return FLASH_TIME;