diff options
| -rw-r--r-- | blackbox.c | 2 | ||||
| -rw-r--r-- | flood.c | 2 | ||||
| -rw-r--r-- | mines.c | 2 | ||||
| -rw-r--r-- | netslide.c | 2 | ||||
| -rw-r--r-- | pattern.c | 2 | ||||
| -rw-r--r-- | sixteen.c | 3 | ||||
| -rw-r--r-- | twiddle.c | 2 |
7 files changed, 13 insertions, 2 deletions
@@ -198,6 +198,8 @@ static const char *validate_params(const game_params *params, bool full) return "Widths and heights greater than 255 are not supported"; if (params->minballs < 0) return "Negative number of balls"; + if (params->minballs < 1) + return "Number of balls must be at least one"; if (params->minballs > params->maxballs) return "Minimum number of balls may not be greater than maximum"; if (params->minballs >= params->w * params->h) @@ -212,7 +212,7 @@ static game_params *custom_params(const config_item *cfg) static const char *validate_params(const game_params *params, bool full) { - if (params->w < 2 && params->h < 2) + if (params->w * params->h < 2) return "Grid must contain at least two squares"; if (params->w < 1 || params->h < 1) return "Width and height must be at least one"; @@ -279,6 +279,8 @@ static const char *validate_params(const game_params *params, bool full) return "Width times height must not be unreasonably large"; if (params->n < 0) return "Mine count may not be negative"; + if (params->n < 1) + return "Number of mines must be greater than zero"; if (params->n > params->w * params->h - 9) return "Too many mines for grid size"; @@ -318,6 +318,8 @@ static const char *validate_params(const game_params *params, bool full) return "Barrier probability may not be negative"; if (params->barrier_probability > 1) return "Barrier probability may not be greater than 1"; + if (params->movetarget < 0) + return "Number of shuffling moves may not be negative"; return NULL; } @@ -185,6 +185,8 @@ static const char *validate_params(const game_params *params, bool full) if (params->w > INT_MAX - 1 || params->h > INT_MAX - 1 || params->w > INT_MAX / params->h) return "Puzzle must not be unreasonably large"; + if (params->w * params->h < 2) + return "Grid must contain at least two squares"; return NULL; } @@ -180,7 +180,8 @@ static const char *validate_params(const game_params *params, bool full) return "Width and height must both be at least two"; if (params->w > INT_MAX / params->h) return "Width times height must not be unreasonably large"; - + if (params->movetarget < 0) + return "Number of shuffling moves may not be negative"; return NULL; } @@ -219,6 +219,8 @@ static const char *validate_params(const game_params *params, bool full) return "Height must be at least the rotating block size"; if (params->w > INT_MAX / params->h) return "Width times height must not be unreasonably large"; + if (params->movetarget < 0) + return "Number of shuffling moves may not be negative"; return NULL; } |