aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Boyle <chris@boyle.name>2016-12-20 09:13:20 +0000
committerBen Harris <bjh21@bjh21.me.uk>2022-12-15 23:51:59 +0000
commit69e63a810e0bd6f85a46d8490c6e366237e061ef (patch)
tree20f2e2eb9b49861942c1ab1ee1392b3b787e8605
parentaf2d992af0d11ad2a91b4c1f7c04d6c69dbe6e55 (diff)
downloadpuzzles-69e63a810e0bd6f85a46d8490c6e366237e061ef.zip
puzzles-69e63a810e0bd6f85a46d8490c6e366237e061ef.tar.gz
puzzles-69e63a810e0bd6f85a46d8490c6e366237e061ef.tar.bz2
puzzles-69e63a810e0bd6f85a46d8490c6e366237e061ef.tar.xz
magnets: Area constraints; fix message.
(The restriction on 2x2 puzzles is because the board layer-out doesn't use neutral pieces on such small boards, and the only soluble 2x2 boards have neutral pieces. I haven't investigated the Tricky size limit, but it seems entirely reasonable that all the smaller boards are too easy. --bjh21) (cherry picked from Android port, commit 133794977a13767e0c1596be6a5b26f2cf2d1fd1)
-rw-r--r--magnets.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/magnets.c b/magnets.c
index 580f2a2..6a3ac52 100644
--- a/magnets.c
+++ b/magnets.c
@@ -230,8 +230,15 @@ static game_params *custom_params(const config_item *cfg)
static const char *validate_params(const game_params *params, bool full)
{
- if (params->w < 2) return "Width must be at least one";
- if (params->h < 2) return "Height must be at least one";
+ if (params->w < 2) return "Width must be at least two";
+ if (params->h < 2) return "Height must be at least two";
+ if (params->diff >= DIFF_TRICKY) {
+ if (params->w < 5 && params->h < 5)
+ return "Either width or height must be at least five for Tricky";
+ } else {
+ if (params->w < 3 && params->h < 3)
+ return "Either width or height must be at least three";
+ }
if (params->diff < 0 || params->diff >= DIFFCOUNT)
return "Unknown difficulty level";