char *clue_satisfied;
};
-static char *validate_desc(const game_params *params, char *desc);
+static char *validate_desc(const game_params *params, const char *desc);
static int dot_order(const game_state* state, int i, char line_type);
static int face_order(const game_state* state, int i, char line_type);
static solver_state *solve_game_rec(const solver_state *sstate);
/* Generates a (dynamically allocated) new grid, according to the
* type and size requested in params. Does nothing if the grid is already
* generated. */
-static grid *loopy_generate_grid(const game_params *params, char *grid_desc)
+static grid *loopy_generate_grid(const game_params *params,
+ const char *grid_desc)
{
return grid_new(grid_types[params->type], params->w, params->h, grid_desc);
}
* General struct manipulation and other straightforward code
*/
-static game_state *dup_game(game_state *state)
+static game_state *dup_game(const game_state *state)
{
game_state *ret = snew(game_state);
}
}
-static solver_state *new_solver_state(game_state *state, int diff) {
+static solver_state *new_solver_state(const game_state *state, int diff) {
int i;
int num_dots = state->game_grid->num_dots;
int num_faces = state->game_grid->num_faces;
return ret;
}
-static game_params *dup_params(game_params *params)
+static game_params *dup_params(const game_params *params)
{
game_params *ret = snew(game_params);
}
}
-static char *encode_params(game_params *params, int full)
+static char *encode_params(const game_params *params, int full)
{
char str[80];
sprintf(str, "%dx%dt%d", params->w, params->h, params->type);
return dupstr(str);
}
-static config_item *game_configure(game_params *params)
+static config_item *game_configure(const game_params *params)
{
config_item *ret;
char buf[80];
return ret;
}
-static game_params *custom_params(config_item *cfg)
+static game_params *custom_params(const config_item *cfg)
{
game_params *ret = snew(game_params);
return ret;
}
-static char *validate_params(game_params *params, int full)
+static char *validate_params(const game_params *params, int full)
{
if (params->type < 0 || params->type >= NUM_GRID_TYPES)
return "Illegal grid type";
/* Splits up a (optional) grid_desc from the game desc. Returns the
* grid_desc (which needs freeing) and updates the desc pointer to
* start of real desc, or returns NULL if no desc. */
-static char *extract_grid_desc(char **desc)
+static char *extract_grid_desc(const char **desc)
{
char *sep = strchr(*desc, GRID_DESC_SEP), *gd;
int gd_len;
/* We require that the params pass the test in validate_params and that the
* description fills the entire game area */
-static char *validate_desc(const game_params *params, char *desc)
+static char *validate_desc(const game_params *params, const char *desc)
{
int count = 0;
grid *g;
return ret;
}
-static game_ui *new_ui(game_state *state)
+static game_ui *new_ui(const game_state *state)
{
return NULL;
}
{
}
-static char *encode_ui(game_ui *ui)
+static char *encode_ui(const game_ui *ui)
{
return NULL;
}
-static void decode_ui(game_ui *ui, char *encoding)
+static void decode_ui(game_ui *ui, const char *encoding)
{
}
-static void game_changed_state(game_ui *ui, game_state *oldstate,
- game_state *newstate)
+static void game_changed_state(game_ui *ui, const game_state *oldstate,
+ const game_state *newstate)
{
}
-static void game_compute_size(game_params *params, int tilesize,
+static void game_compute_size(const game_params *params, int tilesize,
int *x, int *y)
{
int grid_width, grid_height, rendered_width, rendered_height;
}
static void game_set_size(drawing *dr, game_drawstate *ds,
- game_params *params, int tilesize)
+ const game_params *params, int tilesize)
{
ds->tilesize = tilesize;
}
static float *game_colours(frontend *fe, int *ncolours)
{
- float *ret = snewn(4 * NCOLOURS, float);
+ float *ret = snewn(3 * NCOLOURS, float);
frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
return ret;
}
-static game_drawstate *game_new_drawstate(drawing *dr, game_state *state)
+static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state)
{
struct game_drawstate *ds = snew(struct game_drawstate);
int num_faces = state->game_grid->num_faces;
sfree(ds);
}
-static int game_timing_state(game_state *state, game_ui *ui)
+static int game_timing_state(const game_state *state, game_ui *ui)
{
return TRUE;
}
-static float game_anim_length(game_state *oldstate, game_state *newstate,
- int dir, game_ui *ui)
+static float game_anim_length(const game_state *oldstate,
+ const game_state *newstate, int dir, game_ui *ui)
{
return 0.0F;
}
-static int game_can_format_as_text_now(game_params *params)
+static int game_can_format_as_text_now(const game_params *params)
{
if (params->type != 0)
return FALSE;
return TRUE;
}
-static char *game_text_format(game_state *state)
+static char *game_text_format(const game_state *state)
{
int w, h, W, H;
int x, y, i;
return retval;
}
-static game_state *new_game(midend *me, game_params *params, char *desc)
+static game_state *new_game(midend *me, const game_params *params,
+ const char *desc)
{
int i;
game_state *state = snew(game_state);
return sstate;
}
-static char *solve_game(game_state *state, game_state *currstate,
- char *aux, char **error)
+static char *solve_game(const game_state *state, const game_state *currstate,
+ const char *aux, char **error)
{
char *soln = NULL;
solver_state *sstate, *new_sstate;
* Drawing and mouse-handling
*/
-static char *interpret_move(game_state *state, game_ui *ui, const game_drawstate *ds,
+static char *interpret_move(const game_state *state, game_ui *ui,
+ const game_drawstate *ds,
int x, int y, int button)
{
grid *g = state->game_grid;
return ret;
}
-static game_state *execute_move(game_state *state, char *move)
+static game_state *execute_move(const game_state *state, const char *move)
{
int i;
game_state *newstate = dup_game(state);
}
static void game_redraw_clue(drawing *dr, game_drawstate *ds,
- game_state *state, int i)
+ const game_state *state, int i)
{
grid *g = state->game_grid;
grid_face *f = g->faces + i;
#define NPHASES lenof(loopy_line_redraw_phases)
static void game_redraw_line(drawing *dr, game_drawstate *ds,
- game_state *state, int i, int phase)
+ const game_state *state, int i, int phase)
{
grid *g = state->game_grid;
grid_edge *e = g->edges + i;
}
static void game_redraw_dot(drawing *dr, game_drawstate *ds,
- game_state *state, int i)
+ const game_state *state, int i)
{
grid *g = state->game_grid;
grid_dot *d = g->dots + i;
}
static void game_redraw_in_rect(drawing *dr, game_drawstate *ds,
- game_state *state, int x, int y, int w, int h)
+ const game_state *state,
+ int x, int y, int w, int h)
{
grid *g = state->game_grid;
int i, phase;
draw_update(dr, x, y, w, h);
}
-static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
- game_state *state, int dir, game_ui *ui,
+static void game_redraw(drawing *dr, game_drawstate *ds,
+ const game_state *oldstate, const game_state *state,
+ int dir, const game_ui *ui,
float animtime, float flashtime)
{
#define REDRAW_OBJECTS_LIMIT 16 /* Somewhat arbitrary tradeoff */
ds->started = TRUE;
}
-static float game_flash_length(game_state *oldstate, game_state *newstate,
- int dir, game_ui *ui)
+static float game_flash_length(const game_state *oldstate,
+ const game_state *newstate, int dir, game_ui *ui)
{
if (!oldstate->solved && newstate->solved &&
!oldstate->cheated && !newstate->cheated) {
return 0.0F;
}
-static int game_status(game_state *state)
+static int game_status(const game_state *state)
{
return state->solved ? +1 : 0;
}
-static void game_print_size(game_params *params, float *x, float *y)
+static void game_print_size(const game_params *params, float *x, float *y)
{
int pw, ph;
*y = ph / 100.0F;
}
-static void game_print(drawing *dr, game_state *state, int tilesize)
+static void game_print(drawing *dr, const game_state *state, int tilesize)
{
int ink = print_mono_colour(dr, 0);
int i;