diff options
Diffstat (limited to 'apps/plugins/puzzles/src/net.c')
-rw-r--r-- | apps/plugins/puzzles/src/net.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/apps/plugins/puzzles/src/net.c b/apps/plugins/puzzles/src/net.c index 0b3b82446d..ab2425e4e7 100644 --- a/apps/plugins/puzzles/src/net.c +++ b/apps/plugins/puzzles/src/net.c | |||
@@ -270,35 +270,28 @@ static config_item *game_configure(const game_params *params) | |||
270 | ret[0].name = "Width"; | 270 | ret[0].name = "Width"; |
271 | ret[0].type = C_STRING; | 271 | ret[0].type = C_STRING; |
272 | sprintf(buf, "%d", params->width); | 272 | sprintf(buf, "%d", params->width); |
273 | ret[0].sval = dupstr(buf); | 273 | ret[0].u.string.sval = dupstr(buf); |
274 | ret[0].ival = 0; | ||
275 | 274 | ||
276 | ret[1].name = "Height"; | 275 | ret[1].name = "Height"; |
277 | ret[1].type = C_STRING; | 276 | ret[1].type = C_STRING; |
278 | sprintf(buf, "%d", params->height); | 277 | sprintf(buf, "%d", params->height); |
279 | ret[1].sval = dupstr(buf); | 278 | ret[1].u.string.sval = dupstr(buf); |
280 | ret[1].ival = 0; | ||
281 | 279 | ||
282 | ret[2].name = "Walls wrap around"; | 280 | ret[2].name = "Walls wrap around"; |
283 | ret[2].type = C_BOOLEAN; | 281 | ret[2].type = C_BOOLEAN; |
284 | ret[2].sval = NULL; | 282 | ret[2].u.boolean.bval = params->wrapping; |
285 | ret[2].ival = params->wrapping; | ||
286 | 283 | ||
287 | ret[3].name = "Barrier probability"; | 284 | ret[3].name = "Barrier probability"; |
288 | ret[3].type = C_STRING; | 285 | ret[3].type = C_STRING; |
289 | ftoa(buf, params->barrier_probability); | 286 | ftoa(buf, params->barrier_probability); |
290 | ret[3].sval = dupstr(buf); | 287 | ret[3].u.string.sval = dupstr(buf); |
291 | ret[3].ival = 0; | ||
292 | 288 | ||
293 | ret[4].name = "Ensure unique solution"; | 289 | ret[4].name = "Ensure unique solution"; |
294 | ret[4].type = C_BOOLEAN; | 290 | ret[4].type = C_BOOLEAN; |
295 | ret[4].sval = NULL; | 291 | ret[4].u.boolean.bval = params->unique; |
296 | ret[4].ival = params->unique; | ||
297 | 292 | ||
298 | ret[5].name = NULL; | 293 | ret[5].name = NULL; |
299 | ret[5].type = C_END; | 294 | ret[5].type = C_END; |
300 | ret[5].sval = NULL; | ||
301 | ret[5].ival = 0; | ||
302 | 295 | ||
303 | return ret; | 296 | return ret; |
304 | } | 297 | } |
@@ -307,16 +300,16 @@ static game_params *custom_params(const config_item *cfg) | |||
307 | { | 300 | { |
308 | game_params *ret = snew(game_params); | 301 | game_params *ret = snew(game_params); |
309 | 302 | ||
310 | ret->width = atoi(cfg[0].sval); | 303 | ret->width = atoi(cfg[0].u.string.sval); |
311 | ret->height = atoi(cfg[1].sval); | 304 | ret->height = atoi(cfg[1].u.string.sval); |
312 | ret->wrapping = cfg[2].ival; | 305 | ret->wrapping = cfg[2].u.boolean.bval; |
313 | ret->barrier_probability = (float)atof(cfg[3].sval); | 306 | ret->barrier_probability = (float)atof(cfg[3].u.string.sval); |
314 | ret->unique = cfg[4].ival; | 307 | ret->unique = cfg[4].u.boolean.bval; |
315 | 308 | ||
316 | return ret; | 309 | return ret; |
317 | } | 310 | } |
318 | 311 | ||
319 | static char *validate_params(const game_params *params, int full) | 312 | static const char *validate_params(const game_params *params, int full) |
320 | { | 313 | { |
321 | if (params->width <= 0 || params->height <= 0) | 314 | if (params->width <= 0 || params->height <= 0) |
322 | return "Width and height must both be greater than zero"; | 315 | return "Width and height must both be greater than zero"; |
@@ -1601,7 +1594,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
1601 | return desc; | 1594 | return desc; |
1602 | } | 1595 | } |
1603 | 1596 | ||
1604 | static char *validate_desc(const game_params *params, const char *desc) | 1597 | static const char *validate_desc(const game_params *params, const char *desc) |
1605 | { | 1598 | { |
1606 | int w = params->width, h = params->height; | 1599 | int w = params->width, h = params->height; |
1607 | int i; | 1600 | int i; |
@@ -1752,7 +1745,7 @@ static void free_game(game_state *state) | |||
1752 | } | 1745 | } |
1753 | 1746 | ||
1754 | static char *solve_game(const game_state *state, const game_state *currstate, | 1747 | static char *solve_game(const game_state *state, const game_state *currstate, |
1755 | const char *aux, char **error) | 1748 | const char *aux, const char **error) |
1756 | { | 1749 | { |
1757 | unsigned char *tiles; | 1750 | unsigned char *tiles; |
1758 | char *ret; | 1751 | char *ret; |
@@ -2099,7 +2092,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
2099 | 2092 | ||
2100 | if (ui->cur_visible) { | 2093 | if (ui->cur_visible) { |
2101 | ui->cur_visible = FALSE; | 2094 | ui->cur_visible = FALSE; |
2102 | nullret = ""; | 2095 | nullret = UI_UPDATE; |
2103 | } | 2096 | } |
2104 | 2097 | ||
2105 | /* | 2098 | /* |
@@ -2339,7 +2332,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
2339 | OFFSET(ui->cur_x, ui->cur_y, ui->cur_x, ui->cur_y, dir, state); | 2332 | OFFSET(ui->cur_x, ui->cur_y, ui->cur_x, ui->cur_y, dir, state); |
2340 | ui->cur_visible = TRUE; | 2333 | ui->cur_visible = TRUE; |
2341 | } | 2334 | } |
2342 | return ""; | 2335 | return UI_UPDATE; |
2343 | } else { | 2336 | } else { |
2344 | return NULL; | 2337 | return NULL; |
2345 | } | 2338 | } |