diff options
Diffstat (limited to 'apps/plugins/puzzles/src/lightup.c')
-rw-r--r-- | apps/plugins/puzzles/src/lightup.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/apps/plugins/puzzles/src/lightup.c b/apps/plugins/puzzles/src/lightup.c index 4dd46c8392..fd363e076e 100644 --- a/apps/plugins/puzzles/src/lightup.c +++ b/apps/plugins/puzzles/src/lightup.c | |||
@@ -299,37 +299,32 @@ static config_item *game_configure(const game_params *params) | |||
299 | ret[0].name = "Width"; | 299 | ret[0].name = "Width"; |
300 | ret[0].type = C_STRING; | 300 | ret[0].type = C_STRING; |
301 | sprintf(buf, "%d", params->w); | 301 | sprintf(buf, "%d", params->w); |
302 | ret[0].sval = dupstr(buf); | 302 | ret[0].u.string.sval = dupstr(buf); |
303 | ret[0].ival = 0; | ||
304 | 303 | ||
305 | ret[1].name = "Height"; | 304 | ret[1].name = "Height"; |
306 | ret[1].type = C_STRING; | 305 | ret[1].type = C_STRING; |
307 | sprintf(buf, "%d", params->h); | 306 | sprintf(buf, "%d", params->h); |
308 | ret[1].sval = dupstr(buf); | 307 | ret[1].u.string.sval = dupstr(buf); |
309 | ret[1].ival = 0; | ||
310 | 308 | ||
311 | ret[2].name = "%age of black squares"; | 309 | ret[2].name = "%age of black squares"; |
312 | ret[2].type = C_STRING; | 310 | ret[2].type = C_STRING; |
313 | sprintf(buf, "%d", params->blackpc); | 311 | sprintf(buf, "%d", params->blackpc); |
314 | ret[2].sval = dupstr(buf); | 312 | ret[2].u.string.sval = dupstr(buf); |
315 | ret[2].ival = 0; | ||
316 | 313 | ||
317 | ret[3].name = "Symmetry"; | 314 | ret[3].name = "Symmetry"; |
318 | ret[3].type = C_CHOICES; | 315 | ret[3].type = C_CHOICES; |
319 | ret[3].sval = ":None" | 316 | ret[3].u.choices.choicenames = ":None" |
320 | ":2-way mirror:2-way rotational" | 317 | ":2-way mirror:2-way rotational" |
321 | ":4-way mirror:4-way rotational"; | 318 | ":4-way mirror:4-way rotational"; |
322 | ret[3].ival = params->symm; | 319 | ret[3].u.choices.selected = params->symm; |
323 | 320 | ||
324 | ret[4].name = "Difficulty"; | 321 | ret[4].name = "Difficulty"; |
325 | ret[4].type = C_CHOICES; | 322 | ret[4].type = C_CHOICES; |
326 | ret[4].sval = ":Easy:Tricky:Hard"; | 323 | ret[4].u.choices.choicenames = ":Easy:Tricky:Hard"; |
327 | ret[4].ival = params->difficulty; | 324 | ret[4].u.choices.selected = params->difficulty; |
328 | 325 | ||
329 | ret[5].name = NULL; | 326 | ret[5].name = NULL; |
330 | ret[5].type = C_END; | 327 | ret[5].type = C_END; |
331 | ret[5].sval = NULL; | ||
332 | ret[5].ival = 0; | ||
333 | 328 | ||
334 | return ret; | 329 | return ret; |
335 | } | 330 | } |
@@ -338,16 +333,16 @@ static game_params *custom_params(const config_item *cfg) | |||
338 | { | 333 | { |
339 | game_params *ret = snew(game_params); | 334 | game_params *ret = snew(game_params); |
340 | 335 | ||
341 | ret->w = atoi(cfg[0].sval); | 336 | ret->w = atoi(cfg[0].u.string.sval); |
342 | ret->h = atoi(cfg[1].sval); | 337 | ret->h = atoi(cfg[1].u.string.sval); |
343 | ret->blackpc = atoi(cfg[2].sval); | 338 | ret->blackpc = atoi(cfg[2].u.string.sval); |
344 | ret->symm = cfg[3].ival; | 339 | ret->symm = cfg[3].u.choices.selected; |
345 | ret->difficulty = cfg[4].ival; | 340 | ret->difficulty = cfg[4].u.choices.selected; |
346 | 341 | ||
347 | return ret; | 342 | return ret; |
348 | } | 343 | } |
349 | 344 | ||
350 | static char *validate_params(const game_params *params, int full) | 345 | static const char *validate_params(const game_params *params, int full) |
351 | { | 346 | { |
352 | if (params->w < 2 || params->h < 2) | 347 | if (params->w < 2 || params->h < 2) |
353 | return "Width and height must be at least 2"; | 348 | return "Width and height must be at least 2"; |
@@ -1629,7 +1624,7 @@ goodpuzzle: | |||
1629 | return ret; | 1624 | return ret; |
1630 | } | 1625 | } |
1631 | 1626 | ||
1632 | static char *validate_desc(const game_params *params, const char *desc) | 1627 | static const char *validate_desc(const game_params *params, const char *desc) |
1633 | { | 1628 | { |
1634 | int i; | 1629 | int i; |
1635 | for (i = 0; i < params->w*params->h; i++) { | 1630 | for (i = 0; i < params->w*params->h; i++) { |
@@ -1700,7 +1695,7 @@ static game_state *new_game(midend *me, const game_params *params, | |||
1700 | } | 1695 | } |
1701 | 1696 | ||
1702 | static char *solve_game(const game_state *state, const game_state *currstate, | 1697 | static char *solve_game(const game_state *state, const game_state *currstate, |
1703 | const char *aux, char **error) | 1698 | const char *aux, const char **error) |
1704 | { | 1699 | { |
1705 | game_state *solved; | 1700 | game_state *solved; |
1706 | char *move = NULL, buf[80]; | 1701 | char *move = NULL, buf[80]; |
@@ -1882,7 +1877,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1882 | enum { NONE, FLIP_LIGHT, FLIP_IMPOSSIBLE } action = NONE; | 1877 | enum { NONE, FLIP_LIGHT, FLIP_IMPOSSIBLE } action = NONE; |
1883 | int cx = -1, cy = -1; | 1878 | int cx = -1, cy = -1; |
1884 | unsigned int flags; | 1879 | unsigned int flags; |
1885 | char buf[80], *nullret = NULL, *empty = "", c; | 1880 | char buf[80], *nullret = UI_UPDATE, *empty = UI_UPDATE, c; |
1886 | 1881 | ||
1887 | if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { | 1882 | if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { |
1888 | if (ui->cur_visible) | 1883 | if (ui->cur_visible) |
@@ -2331,7 +2326,8 @@ int main(int argc, char **argv) | |||
2331 | { | 2326 | { |
2332 | game_params *p; | 2327 | game_params *p; |
2333 | game_state *s; | 2328 | game_state *s; |
2334 | char *id = NULL, *desc, *err, *result; | 2329 | char *id = NULL, *desc, *result; |
2330 | const char *err; | ||
2335 | int nsol, diff, really_verbose = 0; | 2331 | int nsol, diff, really_verbose = 0; |
2336 | unsigned int sflags; | 2332 | unsigned int sflags; |
2337 | 2333 | ||