summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/puzzles/src/blackbox.c2
-rw-r--r--apps/plugins/puzzles/src/flood.c4
-rw-r--r--apps/plugins/puzzles/src/mines.c2
-rw-r--r--apps/plugins/puzzles/src/netslide.c2
-rw-r--r--apps/plugins/puzzles/src/pattern.c2
-rw-r--r--apps/plugins/puzzles/src/sixteen.c3
-rw-r--r--apps/plugins/puzzles/src/twiddle.c2
7 files changed, 15 insertions, 2 deletions
diff --git a/apps/plugins/puzzles/src/blackbox.c b/apps/plugins/puzzles/src/blackbox.c
index b334cf7117..192b7f11b6 100644
--- a/apps/plugins/puzzles/src/blackbox.c
+++ b/apps/plugins/puzzles/src/blackbox.c
@@ -200,6 +200,8 @@ static char *validate_params(const game_params *params, int full)
200 return "Minimum number of balls may not be greater than maximum"; 200 return "Minimum number of balls may not be greater than maximum";
201 if (params->minballs >= params->w * params->h) 201 if (params->minballs >= params->w * params->h)
202 return "Too many balls to fit in grid"; 202 return "Too many balls to fit in grid";
203 if (params->minballs < 1)
204 return "Number of balls must be at least one";
203 return NULL; 205 return NULL;
204} 206}
205 207
diff --git a/apps/plugins/puzzles/src/flood.c b/apps/plugins/puzzles/src/flood.c
index 1262be8175..59e160cfc3 100644
--- a/apps/plugins/puzzles/src/flood.c
+++ b/apps/plugins/puzzles/src/flood.c
@@ -213,8 +213,10 @@ static game_params *custom_params(const config_item *cfg)
213 213
214static char *validate_params(const game_params *params, int full) 214static char *validate_params(const game_params *params, int full)
215{ 215{
216 if (params->w < 2 && params->h < 2) 216 if (params->w * params->h < 2)
217 return "Grid must contain at least two squares"; 217 return "Grid must contain at least two squares";
218 if (params->w < 1 || params->h < 1)
219 return "Width and height must both be at least one";
218 if (params->colours < 3 || params->colours > 10) 220 if (params->colours < 3 || params->colours > 10)
219 return "Must have between 3 and 10 colours"; 221 return "Must have between 3 and 10 colours";
220 if (params->leniency < 0) 222 if (params->leniency < 0)
diff --git a/apps/plugins/puzzles/src/mines.c b/apps/plugins/puzzles/src/mines.c
index 3bfe832a5f..4bee0f3157 100644
--- a/apps/plugins/puzzles/src/mines.c
+++ b/apps/plugins/puzzles/src/mines.c
@@ -265,6 +265,8 @@ static char *validate_params(const game_params *params, int full)
265 return "Width and height must both be greater than two"; 265 return "Width and height must both be greater than two";
266 if (params->n > params->w * params->h - 9) 266 if (params->n > params->w * params->h - 9)
267 return "Too many mines for grid size"; 267 return "Too many mines for grid size";
268 if (params->n < 1)
269 return "Number of mines must be greater than zero";
268 270
269 /* 271 /*
270 * FIXME: Need more constraints here. Not sure what the 272 * FIXME: Need more constraints here. Not sure what the
diff --git a/apps/plugins/puzzles/src/netslide.c b/apps/plugins/puzzles/src/netslide.c
index 663febc61a..96ac8e7eea 100644
--- a/apps/plugins/puzzles/src/netslide.c
+++ b/apps/plugins/puzzles/src/netslide.c
@@ -320,6 +320,8 @@ static char *validate_params(const game_params *params, int full)
320 return "Barrier probability may not be negative"; 320 return "Barrier probability may not be negative";
321 if (params->barrier_probability > 1) 321 if (params->barrier_probability > 1)
322 return "Barrier probability may not be greater than 1"; 322 return "Barrier probability may not be greater than 1";
323 if (params->movetarget < 0)
324 return "Number of shuffling moves may not be negative";
323 return NULL; 325 return NULL;
324} 326}
325 327
diff --git a/apps/plugins/puzzles/src/pattern.c b/apps/plugins/puzzles/src/pattern.c
index 9a74e55318..15cdd281c9 100644
--- a/apps/plugins/puzzles/src/pattern.c
+++ b/apps/plugins/puzzles/src/pattern.c
@@ -179,6 +179,8 @@ static char *validate_params(const game_params *params, int full)
179{ 179{
180 if (params->w <= 0 || params->h <= 0) 180 if (params->w <= 0 || params->h <= 0)
181 return "Width and height must both be greater than zero"; 181 return "Width and height must both be greater than zero";
182 if (params->w * params->w < 2)
183 return "Grid must contain at least two squares";
182 return NULL; 184 return NULL;
183} 185}
184 186
diff --git a/apps/plugins/puzzles/src/sixteen.c b/apps/plugins/puzzles/src/sixteen.c
index edc9771867..aaf524a0d6 100644
--- a/apps/plugins/puzzles/src/sixteen.c
+++ b/apps/plugins/puzzles/src/sixteen.c
@@ -178,7 +178,8 @@ static char *validate_params(const game_params *params, int full)
178{ 178{
179 if (params->w < 2 || params->h < 2) 179 if (params->w < 2 || params->h < 2)
180 return "Width and height must both be at least two"; 180 return "Width and height must both be at least two";
181 181 if (params->movetarget < 0)
182 return "Number of shuffling moves may not be negative";
182 return NULL; 183 return NULL;
183} 184}
184 185
diff --git a/apps/plugins/puzzles/src/twiddle.c b/apps/plugins/puzzles/src/twiddle.c
index 6e05f4ddec..224c0418f1 100644
--- a/apps/plugins/puzzles/src/twiddle.c
+++ b/apps/plugins/puzzles/src/twiddle.c
@@ -217,6 +217,8 @@ static char *validate_params(const game_params *params, int full)
217 return "Width must be at least the rotating block size"; 217 return "Width must be at least the rotating block size";
218 if (params->h < params->n) 218 if (params->h < params->n)
219 return "Height must be at least the rotating block size"; 219 return "Height must be at least the rotating block size";
220 if (params->movetarget < 0)
221 return "Number of shuffling moves may not be negative";
220 return NULL; 222 return NULL;
221} 223}
222 224