diff --git a/blackbox.c b/blackbox.c index 43323f9..ab8e382 100644 --- a/blackbox.c +++ b/blackbox.c @@ -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) diff --git a/flood.c b/flood.c index bef45f3..fe80974 100644 --- a/flood.c +++ b/flood.c @@ -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"; diff --git a/mines.c b/mines.c index d823341..e1441fa 100644 --- a/mines.c +++ b/mines.c @@ -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"; diff --git a/netslide.c b/netslide.c index e3d03c4..4e6e82b 100644 --- a/netslide.c +++ b/netslide.c @@ -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; } diff --git a/pattern.c b/pattern.c index d38cada..b370a3d 100644 --- a/pattern.c +++ b/pattern.c @@ -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; } diff --git a/sixteen.c b/sixteen.c index fef2e5f..38f6711 100644 --- a/sixteen.c +++ b/sixteen.c @@ -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; } diff --git a/twiddle.c b/twiddle.c index 9aea4e4..b3aa06f 100644 --- a/twiddle.c +++ b/twiddle.c @@ -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; }