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)
This commit is contained in:
Chris Boyle
2016-12-20 09:13:20 +00:00
committed by Ben Harris
parent af2d992af0
commit 69e63a810e

View File

@ -230,8 +230,15 @@ static game_params *custom_params(const config_item *cfg)
static const char *validate_params(const game_params *params, bool full) static const char *validate_params(const game_params *params, bool full)
{ {
if (params->w < 2) return "Width 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 one"; 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) if (params->diff < 0 || params->diff >= DIFFCOUNT)
return "Unknown difficulty level"; return "Unknown difficulty level";