aboutsummaryrefslogtreecommitdiff
path: root/magnets.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-04-12 17:11:49 +0000
committerSimon Tatham <anakin@pobox.com>2013-04-12 17:11:49 +0000
commit0b93de904a98f119b1a95d3a53029f1ed4bfb9b3 (patch)
treee1fef5c0a006feb7c2a631c7e5c81487221734d7 /magnets.c
parent383c15794a517a4e6dc0b7364edac1f7056cee82 (diff)
downloadpuzzles-0b93de904a98f119b1a95d3a53029f1ed4bfb9b3.zip
puzzles-0b93de904a98f119b1a95d3a53029f1ed4bfb9b3.tar.gz
puzzles-0b93de904a98f119b1a95d3a53029f1ed4bfb9b3.tar.bz2
puzzles-0b93de904a98f119b1a95d3a53029f1ed4bfb9b3.tar.xz
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]
Diffstat (limited to 'magnets.c')
-rw-r--r--magnets.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/magnets.c b/magnets.c
index e9b8c7d..2f56c7c 100644
--- a/magnets.c
+++ b/magnets.c
@@ -422,7 +422,8 @@ badchar:
return NULL;
}
-static game_state *new_game_int(game_params *params, char *desc, const char **prob)
+static game_state *new_game_int(const game_params *params, char *desc,
+ const char **prob)
{
game_state *state = new_state(params->w, params->h);
int x, y, idx, *count;
@@ -529,7 +530,7 @@ done:
return state;
}
-static char *validate_desc(game_params *params, char *desc)
+static char *validate_desc(const game_params *params, char *desc)
{
const char *prob;
game_state *st = new_game_int(params, desc, &prob);
@@ -1603,7 +1604,7 @@ static void generate_aux(game_state *new, char *aux)
aux[new->wh] = '\0';
}
-static int check_difficulty(game_params *params, game_state *new,
+static int check_difficulty(const game_params *params, game_state *new,
random_state *rs)
{
int *scratch, *grid_correct, slen, i;
@@ -1675,7 +1676,7 @@ static int check_difficulty(game_params *params, game_state *new,
return 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_r, int interactive)
{
game_state *new = new_state(params->w, params->h);