ret[0].name = "Width";
ret[0].type = C_STRING;
sprintf(buf, "%d", params->w);
- ret[0].sval = dupstr(buf);
- ret[0].ival = 0;
+ ret[0].u.string.sval = dupstr(buf);
ret[1].name = "Height";
ret[1].type = C_STRING;
sprintf(buf, "%d", params->h);
- ret[1].sval = dupstr(buf);
- ret[1].ival = 0;
+ ret[1].u.string.sval = dupstr(buf);
ret[2].name = NULL;
ret[2].type = C_END;
- ret[2].sval = NULL;
- ret[2].ival = 0;
return ret;
}
{
game_params *ret = snew(game_params);
- ret->w = atoi(cfg[0].sval);
- ret->h = atoi(cfg[1].sval);
+ ret->w = atoi(cfg[0].u.string.sval);
+ ret->h = atoi(cfg[1].u.string.sval);
return ret;
}
-static char *validate_params(const game_params *params, int full)
+static const char *validate_params(const game_params *params, int full)
{
if (params->w <= 0 || params->h <= 0)
return "Width and height must both be greater than zero";
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 i, n, rowspace;
const char *p;
}
static char *solve_game(const game_state *state, const game_state *currstate,
- const char *ai, char **error)
+ const char *ai, const char **error)
{
unsigned char *matrix;
int w = state->common->w, h = state->common->h;
ui->drag_start_y = ui->drag_end_y = y;
ui->cur_visible = 0;
- return ""; /* UI activity occurred */
+ return UI_UPDATE;
}
if (ui->dragging && button == ui->drag) {
ui->drag_end_x = x;
ui->drag_end_y = y;
- return ""; /* UI activity occurred */
+ return UI_UPDATE;
}
if (ui->dragging && button == ui->release) {
x1, y1, x2-x1+1, y2-y1+1);
return dupstr(buf);
} else
- return ""; /* UI activity occurred */
+ return UI_UPDATE;
}
if (IS_CURSOR_MOVE(button)) {
char buf[80];
move_cursor(button, &ui->cur_x, &ui->cur_y, state->common->w, state->common->h, 0);
ui->cur_visible = 1;
- if (!control && !shift) return "";
+ if (!control && !shift) return UI_UPDATE;
newstate = control ? shift ? GRID_UNKNOWN : GRID_FULL : GRID_EMPTY;
if (state->grid[y * state->common->w + x] == newstate &&
state->grid[ui->cur_y * state->common->w + ui->cur_x] == newstate)
- return "";
+ return UI_UPDATE;
sprintf(buf, "%c%d,%d,%d,%d", control ? shift ? 'U' : 'F' : 'E',
min(x, ui->cur_x), min(y, ui->cur_y),
if (!ui->cur_visible) {
ui->cur_visible = 1;
- return "";
+ return UI_UPDATE;
}
if (button == CURSOR_SELECT2)
{
game_params *p;
game_state *s;
- char *id = NULL, *desc, *err;
+ char *id = NULL, *desc;
+ const char *err;
while (--argc > 0) {
char *p = *++argv;