Add 'const' to the game_params arguments in validate_desc and

new_desc. Oddities in the 'make test' output brought to my attention
that a few puzzles have been modifying their input game_params for
various reasons; they shouldn't do that, because that's the
game_params held permanently by the midend and it will affect
subsequent game generations if they modify it. So now those arguments
are const, and all the games which previously modified their
game_params now take a copy and modify that instead.

[originally from svn r9830]
This commit is contained in:
Simon Tatham
2013-04-12 17:11:49 +00:00
parent 383c15794a
commit 0b93de904a
43 changed files with 117 additions and 105 deletions

View File

@ -1735,7 +1735,7 @@ static int solve_from_scratch(game_state *state, int difficulty)
/* --- New game functions --- */
static game_state *new_state(game_params *params)
static game_state *new_state(const game_params *params)
{
game_state *ret = snew(game_state);
int wh = params->w * params->h, i;
@ -1845,7 +1845,7 @@ static void free_game(game_state *state)
#define ORDER(a,b) do { if (a < b) { int tmp=a; int a=b; int b=tmp; } } while(0)
static char *new_game_desc(game_params *params, random_state *rs,
static char *new_game_desc(const game_params *params, random_state *rs,
char **aux, int interactive)
{
game_state *tobuild = NULL;
@ -2015,7 +2015,7 @@ generated:
return ret;
}
static char *validate_desc(game_params *params, char *desc)
static char *validate_desc(const game_params *params, char *desc)
{
int i, wh = params->w * params->h;