#define setmember(obj, field) ( (obj) . field = field )
-static char *nfmtstr(int n, char *fmt, ...) {
+static char *nfmtstr(int n, const char *fmt, ...) {
va_list va;
char *ret = snewn(n+1, char);
va_start(va, fmt);
ret[0].name = "Width";
ret[0].type = C_STRING;
- ret[0].sval = nfmtstr(10, "%d", params->w);
- ret[0].ival = 0;
+ ret[0].u.string.sval = nfmtstr(10, "%d", params->w);
ret[1].name = "Height";
ret[1].type = C_STRING;
- ret[1].sval = nfmtstr(10, "%d", params->h);
- ret[1].ival = 0;
+ ret[1].u.string.sval = nfmtstr(10, "%d", params->h);
ret[2].name = NULL;
ret[2].type = C_END;
- ret[2].sval = NULL;
- ret[2].ival = 0;
return ret;
}
static game_params *custom_params(const config_item *configuration)
{
game_params *ret = snew(game_params);
- ret->w = atoi(configuration[0].sval);
- ret->h = atoi(configuration[1].sval);
+ ret->w = atoi(configuration[0].u.string.sval);
+ ret->h = atoi(configuration[1].u.string.sval);
return ret;
}
static move *solve_internal(const game_state *state, move *base, int diff);
static char *solve_game(const game_state *orig, const game_state *curpos,
- const char *aux, char **error)
+ const char *aux, const char **error)
{
int const n = orig->params.w * orig->params.h;
move *const base = snewn(n, move);
return k;
}
-static char *validate_params(const game_params *params, int full)
+static const char *validate_params(const game_params *params, int full)
{
int const w = params->w, h = params->h;
if (w < 1) return "Error: width is less than 1";
return desc;
}
-static char *validate_desc(const game_params *params, const char *desc)
+static const char *validate_desc(const game_params *params, const char *desc)
{
int const n = params->w * params->h;
int squares = 0;
static char *game_text_format(const game_state *state)
{
- int cellsize, r, c, i, w_string, h_string, n_string;
+ int r, c, i, w_string, h_string, n_string;
+ char cellsize;
char *ret, *buf, *gridline;
int const w = state->params.w, h = state->params.h;
else if (do_post)
return nfmtstr(40, "W,%d,%d", ui->r, ui->c);
else
- return "";
+ return UI_UPDATE;
} else if (!out_of_bounds(ui->r + dr[i], ui->c + dc[i], w, h)) {
ui->r += dr[i];
ui->c += dc[i];
}
} else ui->cursor_show = TRUE;
- return "";
+ return UI_UPDATE;
}
if (action == hint) {