diff options
Diffstat (limited to 'apps/plugins/puzzles/src/unruly.c')
-rw-r--r-- | apps/plugins/puzzles/src/unruly.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/apps/plugins/puzzles/src/unruly.c b/apps/plugins/puzzles/src/unruly.c index f418efa776..9d2d5924d2 100644 --- a/apps/plugins/puzzles/src/unruly.c +++ b/apps/plugins/puzzles/src/unruly.c | |||
@@ -239,28 +239,24 @@ static config_item *game_configure(const game_params *params) | |||
239 | ret[0].name = "Width"; | 239 | ret[0].name = "Width"; |
240 | ret[0].type = C_STRING; | 240 | ret[0].type = C_STRING; |
241 | sprintf(buf, "%d", params->w2); | 241 | sprintf(buf, "%d", params->w2); |
242 | ret[0].sval = dupstr(buf); | 242 | ret[0].u.string.sval = dupstr(buf); |
243 | ret[0].ival = 0; | ||
244 | 243 | ||
245 | ret[1].name = "Height"; | 244 | ret[1].name = "Height"; |
246 | ret[1].type = C_STRING; | 245 | ret[1].type = C_STRING; |
247 | sprintf(buf, "%d", params->h2); | 246 | sprintf(buf, "%d", params->h2); |
248 | ret[1].sval = dupstr(buf); | 247 | ret[1].u.string.sval = dupstr(buf); |
249 | ret[1].ival = 0; | ||
250 | 248 | ||
251 | ret[2].name = "Unique rows and columns"; | 249 | ret[2].name = "Unique rows and columns"; |
252 | ret[2].type = C_BOOLEAN; | 250 | ret[2].type = C_BOOLEAN; |
253 | ret[2].ival = params->unique; | 251 | ret[2].u.boolean.bval = params->unique; |
254 | 252 | ||
255 | ret[3].name = "Difficulty"; | 253 | ret[3].name = "Difficulty"; |
256 | ret[3].type = C_CHOICES; | 254 | ret[3].type = C_CHOICES; |
257 | ret[3].sval = DIFFCONFIG; | 255 | ret[3].u.choices.choicenames = DIFFCONFIG; |
258 | ret[3].ival = params->diff; | 256 | ret[3].u.choices.selected = params->diff; |
259 | 257 | ||
260 | ret[4].name = NULL; | 258 | ret[4].name = NULL; |
261 | ret[4].type = C_END; | 259 | ret[4].type = C_END; |
262 | ret[4].sval = NULL; | ||
263 | ret[4].ival = 0; | ||
264 | 260 | ||
265 | return ret; | 261 | return ret; |
266 | } | 262 | } |
@@ -269,15 +265,15 @@ static game_params *custom_params(const config_item *cfg) | |||
269 | { | 265 | { |
270 | game_params *ret = snew(game_params); | 266 | game_params *ret = snew(game_params); |
271 | 267 | ||
272 | ret->w2 = atoi(cfg[0].sval); | 268 | ret->w2 = atoi(cfg[0].u.string.sval); |
273 | ret->h2 = atoi(cfg[1].sval); | 269 | ret->h2 = atoi(cfg[1].u.string.sval); |
274 | ret->unique = cfg[2].ival; | 270 | ret->unique = cfg[2].u.boolean.bval; |
275 | ret->diff = cfg[3].ival; | 271 | ret->diff = cfg[3].u.choices.selected; |
276 | 272 | ||
277 | return ret; | 273 | return ret; |
278 | } | 274 | } |
279 | 275 | ||
280 | static char *validate_params(const game_params *params, int full) | 276 | static const char *validate_params(const game_params *params, int full) |
281 | { | 277 | { |
282 | if ((params->w2 & 1) || (params->h2 & 1)) | 278 | if ((params->w2 & 1) || (params->h2 & 1)) |
283 | return "Width and height must both be even"; | 279 | return "Width and height must both be even"; |
@@ -319,7 +315,7 @@ static char *validate_params(const game_params *params, int full) | |||
319 | return NULL; | 315 | return NULL; |
320 | } | 316 | } |
321 | 317 | ||
322 | static char *validate_desc(const game_params *params, const char *desc) | 318 | static const char *validate_desc(const game_params *params, const char *desc) |
323 | { | 319 | { |
324 | int w2 = params->w2, h2 = params->h2; | 320 | int w2 = params->w2, h2 = params->h2; |
325 | int s = w2 * h2; | 321 | int s = w2 * h2; |
@@ -1178,7 +1174,7 @@ static int unruly_solve_game(game_state *state, | |||
1178 | } | 1174 | } |
1179 | 1175 | ||
1180 | static char *solve_game(const game_state *state, const game_state *currstate, | 1176 | static char *solve_game(const game_state *state, const game_state *currstate, |
1181 | const char *aux, char **error) | 1177 | const char *aux, const char **error) |
1182 | { | 1178 | { |
1183 | game_state *solved = dup_game(state); | 1179 | game_state *solved = dup_game(state); |
1184 | struct unruly_scratch *scratch = unruly_new_scratch(solved); | 1180 | struct unruly_scratch *scratch = unruly_new_scratch(solved); |
@@ -1531,7 +1527,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1531 | if (IS_CURSOR_MOVE(button)) { | 1527 | if (IS_CURSOR_MOVE(button)) { |
1532 | move_cursor(button, &ui->cx, &ui->cy, w2, h2, 0); | 1528 | move_cursor(button, &ui->cx, &ui->cy, w2, h2, 0); |
1533 | ui->cursor = TRUE; | 1529 | ui->cursor = TRUE; |
1534 | return ""; | 1530 | return UI_UPDATE; |
1535 | } | 1531 | } |
1536 | 1532 | ||
1537 | /* Place one */ | 1533 | /* Place one */ |
@@ -1976,7 +1972,8 @@ int main(int argc, char *argv[]) | |||
1976 | 1972 | ||
1977 | game_params *params = NULL; | 1973 | game_params *params = NULL; |
1978 | 1974 | ||
1979 | char *id = NULL, *desc = NULL, *err; | 1975 | char *id = NULL, *desc = NULL; |
1976 | const char *err; | ||
1980 | 1977 | ||
1981 | quis = argv[0]; | 1978 | quis = argv[0]; |
1982 | 1979 | ||