mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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:
7
cube.c
7
cube.c
@ -315,7 +315,8 @@ static char *encode_params(game_params *params, int full)
|
||||
}
|
||||
typedef void (*egc_callback)(void *, struct grid_square *);
|
||||
|
||||
static void enum_grid_squares(game_params *params, egc_callback callback, void *ctx)
|
||||
static void enum_grid_squares(const game_params *params, egc_callback callback,
|
||||
void *ctx)
|
||||
{
|
||||
const struct solid *solid = solids[params->solid];
|
||||
|
||||
@ -597,7 +598,7 @@ static void classify_grid_square_callback(void *ctx, struct grid_square *sq)
|
||||
data->squareindex++;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct grid_data data;
|
||||
@ -845,7 +846,7 @@ static struct solid *transform_poly(const struct solid *solid, int flip,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *validate_desc(game_params *params, char *desc)
|
||||
static char *validate_desc(const game_params *params, char *desc)
|
||||
{
|
||||
int area = grid_area(params->d1, params->d2, solids[params->solid]->order);
|
||||
int i, j;
|
||||
|
Reference in New Issue
Block a user