diff options
Diffstat (limited to 'apps/plugins/puzzles/src/netslide.c')
-rw-r--r-- | apps/plugins/puzzles/src/netslide.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/apps/plugins/puzzles/src/netslide.c b/apps/plugins/puzzles/src/netslide.c index bb9b0999ea..d4d9856295 100644 --- a/apps/plugins/puzzles/src/netslide.c +++ b/apps/plugins/puzzles/src/netslide.c | |||
@@ -265,36 +265,29 @@ static config_item *game_configure(const game_params *params) | |||
265 | ret[0].name = "Width"; | 265 | ret[0].name = "Width"; |
266 | ret[0].type = C_STRING; | 266 | ret[0].type = C_STRING; |
267 | sprintf(buf, "%d", params->width); | 267 | sprintf(buf, "%d", params->width); |
268 | ret[0].sval = dupstr(buf); | 268 | ret[0].u.string.sval = dupstr(buf); |
269 | ret[0].ival = 0; | ||
270 | 269 | ||
271 | ret[1].name = "Height"; | 270 | ret[1].name = "Height"; |
272 | ret[1].type = C_STRING; | 271 | ret[1].type = C_STRING; |
273 | sprintf(buf, "%d", params->height); | 272 | sprintf(buf, "%d", params->height); |
274 | ret[1].sval = dupstr(buf); | 273 | ret[1].u.string.sval = dupstr(buf); |
275 | ret[1].ival = 0; | ||
276 | 274 | ||
277 | ret[2].name = "Walls wrap around"; | 275 | ret[2].name = "Walls wrap around"; |
278 | ret[2].type = C_BOOLEAN; | 276 | ret[2].type = C_BOOLEAN; |
279 | ret[2].sval = NULL; | 277 | ret[2].u.boolean.bval = params->wrapping; |
280 | ret[2].ival = params->wrapping; | ||
281 | 278 | ||
282 | ret[3].name = "Barrier probability"; | 279 | ret[3].name = "Barrier probability"; |
283 | ret[3].type = C_STRING; | 280 | ret[3].type = C_STRING; |
284 | ftoa(buf, params->barrier_probability); | 281 | ftoa(buf, params->barrier_probability); |
285 | ret[3].sval = dupstr(buf); | 282 | ret[3].u.string.sval = dupstr(buf); |
286 | ret[3].ival = 0; | ||
287 | 283 | ||
288 | ret[4].name = "Number of shuffling moves"; | 284 | ret[4].name = "Number of shuffling moves"; |
289 | ret[4].type = C_STRING; | 285 | ret[4].type = C_STRING; |
290 | sprintf(buf, "%d", params->movetarget); | 286 | sprintf(buf, "%d", params->movetarget); |
291 | ret[4].sval = dupstr(buf); | 287 | ret[4].u.string.sval = dupstr(buf); |
292 | ret[4].ival = 0; | ||
293 | 288 | ||
294 | ret[5].name = NULL; | 289 | ret[5].name = NULL; |
295 | ret[5].type = C_END; | 290 | ret[5].type = C_END; |
296 | ret[5].sval = NULL; | ||
297 | ret[5].ival = 0; | ||
298 | 291 | ||
299 | return ret; | 292 | return ret; |
300 | } | 293 | } |
@@ -303,16 +296,16 @@ static game_params *custom_params(const config_item *cfg) | |||
303 | { | 296 | { |
304 | game_params *ret = snew(game_params); | 297 | game_params *ret = snew(game_params); |
305 | 298 | ||
306 | ret->width = atoi(cfg[0].sval); | 299 | ret->width = atoi(cfg[0].u.string.sval); |
307 | ret->height = atoi(cfg[1].sval); | 300 | ret->height = atoi(cfg[1].u.string.sval); |
308 | ret->wrapping = cfg[2].ival; | 301 | ret->wrapping = cfg[2].u.boolean.bval; |
309 | ret->barrier_probability = (float)atof(cfg[3].sval); | 302 | ret->barrier_probability = (float)atof(cfg[3].u.string.sval); |
310 | ret->movetarget = atoi(cfg[4].sval); | 303 | ret->movetarget = atoi(cfg[4].u.string.sval); |
311 | 304 | ||
312 | return ret; | 305 | return ret; |
313 | } | 306 | } |
314 | 307 | ||
315 | static char *validate_params(const game_params *params, int full) | 308 | static const char *validate_params(const game_params *params, int full) |
316 | { | 309 | { |
317 | if (params->width <= 1 || params->height <= 1) | 310 | if (params->width <= 1 || params->height <= 1) |
318 | return "Width and height must both be greater than one"; | 311 | return "Width and height must both be greater than one"; |
@@ -701,7 +694,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
701 | return desc; | 694 | return desc; |
702 | } | 695 | } |
703 | 696 | ||
704 | static char *validate_desc(const game_params *params, const char *desc) | 697 | static const char *validate_desc(const game_params *params, const char *desc) |
705 | { | 698 | { |
706 | int w = params->width, h = params->height; | 699 | int w = params->width, h = params->height; |
707 | int i; | 700 | int i; |
@@ -891,7 +884,7 @@ static void free_game(game_state *state) | |||
891 | } | 884 | } |
892 | 885 | ||
893 | static char *solve_game(const game_state *state, const game_state *currstate, | 886 | static char *solve_game(const game_state *state, const game_state *currstate, |
894 | const char *aux, char **error) | 887 | const char *aux, const char **error) |
895 | { | 888 | { |
896 | if (!aux) { | 889 | if (!aux) { |
897 | *error = "Solution not known for this puzzle"; | 890 | *error = "Solution not known for this puzzle"; |
@@ -1084,7 +1077,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1084 | } | 1077 | } |
1085 | 1078 | ||
1086 | ui->cur_visible = 1; | 1079 | ui->cur_visible = 1; |
1087 | return ""; | 1080 | return UI_UPDATE; |
1088 | } | 1081 | } |
1089 | 1082 | ||
1090 | if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { | 1083 | if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { |
@@ -1098,7 +1091,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1098 | } else { | 1091 | } else { |
1099 | /* 'click' when cursor is invisible just makes cursor visible. */ | 1092 | /* 'click' when cursor is invisible just makes cursor visible. */ |
1100 | ui->cur_visible = 1; | 1093 | ui->cur_visible = 1; |
1101 | return ""; | 1094 | return UI_UPDATE; |
1102 | } | 1095 | } |
1103 | } else | 1096 | } else |
1104 | return NULL; | 1097 | return NULL; |