Add a `full' parameter to validate_params(), analogous to the one in

encode_params(). This is necessary for cases where generation-time parameters
that are normally omitted from descriptive IDs can place restrictions on other
parameters; in particular, when the default value of a relevant generation-time
parameter is not the one used to generate the descriptive ID, validation could
reject self-generated IDs (e.g., Net `5x2w:56182ae7c2', and some cases in
`Pegs').

[originally from svn r6068]
This commit is contained in:
Jacob Nevins
2005-07-05 21:27:19 +00:00
parent 968828283b
commit f3c95109c7
18 changed files with 39 additions and 26 deletions

View File

@ -237,7 +237,7 @@ static game_params *custom_params(config_item *cfg)
return ret;
}
static char *validate_params(game_params *params)
static char *validate_params(game_params *params, int full)
{
/*
* Lower limit on grid size: each dimension must be at least 3.
@ -253,7 +253,7 @@ static char *validate_params(game_params *params)
* _have_ to have a gap somewhere which you can't determine the
* position of.
*/
if (params->w <= 2 || params->h <= 2)
if (full && params->unique && (params->w <= 2 || params->h <= 2))
return "Width and height must both be greater than two";
if (params->n > params->w * params->h - 9)
return "Too many mines for grid size";