From ef1306764e6443d67612542654f252b376c5993e Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Mon, 23 Oct 2017 17:19:29 -0400 Subject: puzzles: resync with upstream There have been some improvements with regard to small screen sizes, which will be nice to have. Change-Id: I30c740514156258d2818fde325c1a751500f7611 --- apps/plugins/puzzles/src/untangle.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'apps/plugins/puzzles/src/untangle.c') diff --git a/apps/plugins/puzzles/src/untangle.c b/apps/plugins/puzzles/src/untangle.c index 441c8658ce..6c2eb30deb 100644 --- a/apps/plugins/puzzles/src/untangle.c +++ b/apps/plugins/puzzles/src/untangle.c @@ -187,13 +187,10 @@ static config_item *game_configure(const game_params *params) ret[0].name = "Number of points"; ret[0].type = C_STRING; sprintf(buf, "%d", params->n); - ret[0].sval = dupstr(buf); - ret[0].ival = 0; + ret[0].u.string.sval = dupstr(buf); ret[1].name = NULL; ret[1].type = C_END; - ret[1].sval = NULL; - ret[1].ival = 0; return ret; } @@ -202,12 +199,12 @@ static game_params *custom_params(const config_item *cfg) { game_params *ret = snew(game_params); - ret->n = atoi(cfg[0].sval); + ret->n = atoi(cfg[0].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->n < 4) return "Number of points must be at least four"; @@ -661,7 +658,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, */ ret = NULL; { - char *sep; + const char *sep; char buf[80]; int retlen; edge *ea; @@ -736,7 +733,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, return ret; } -static char *validate_desc(const game_params *params, const char *desc) +static const char *validate_desc(const game_params *params, const char *desc) { int a, b; @@ -883,7 +880,7 @@ static void free_game(game_state *state) } static char *solve_game(const game_state *state, const game_state *currstate, - const char *aux, char **error) + const char *aux, const char **error) { int n = state->params.n; int matrix[4]; @@ -1126,14 +1123,14 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->newpoint.x = x; ui->newpoint.y = y; ui->newpoint.d = ds->tilesize; - return ""; + return UI_UPDATE; } } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) { ui->newpoint.x = x; ui->newpoint.y = y; ui->newpoint.d = ds->tilesize; - return ""; + return UI_UPDATE; } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) { int p = ui->dragpoint; char buf[80]; @@ -1148,7 +1145,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->newpoint.x >= (long)state->w*ui->newpoint.d || ui->newpoint.y < 0 || ui->newpoint.y >= (long)state->h*ui->newpoint.d) - return ""; + return UI_UPDATE; /* * We aren't cancelling the drag. Construct a move string -- cgit v1.2.3