summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/unfinished/slide.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/unfinished/slide.c')
-rw-r--r--apps/plugins/puzzles/src/unfinished/slide.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/apps/plugins/puzzles/src/unfinished/slide.c b/apps/plugins/puzzles/src/unfinished/slide.c
index 9d4fce1461..9770013235 100644
--- a/apps/plugins/puzzles/src/unfinished/slide.c
+++ b/apps/plugins/puzzles/src/unfinished/slide.c
@@ -244,25 +244,20 @@ static config_item *game_configure(const game_params *params)
244 ret[0].name = "Width"; 244 ret[0].name = "Width";
245 ret[0].type = C_STRING; 245 ret[0].type = C_STRING;
246 sprintf(buf, "%d", params->w); 246 sprintf(buf, "%d", params->w);
247 ret[0].sval = dupstr(buf); 247 ret[0].u.string.sval = dupstr(buf);
248 ret[0].ival = 0;
249 248
250 ret[1].name = "Height"; 249 ret[1].name = "Height";
251 ret[1].type = C_STRING; 250 ret[1].type = C_STRING;
252 sprintf(buf, "%d", params->h); 251 sprintf(buf, "%d", params->h);
253 ret[1].sval = dupstr(buf); 252 ret[1].u.string.sval = dupstr(buf);
254 ret[1].ival = 0;
255 253
256 ret[2].name = "Solution length limit"; 254 ret[2].name = "Solution length limit";
257 ret[2].type = C_STRING; 255 ret[2].type = C_STRING;
258 sprintf(buf, "%d", params->maxmoves); 256 sprintf(buf, "%d", params->maxmoves);
259 ret[2].sval = dupstr(buf); 257 ret[2].u.string.sval = dupstr(buf);
260 ret[2].ival = 0;
261 258
262 ret[3].name = NULL; 259 ret[3].name = NULL;
263 ret[3].type = C_END; 260 ret[3].type = C_END;
264 ret[3].sval = NULL;
265 ret[3].ival = 0;
266 261
267 return ret; 262 return ret;
268} 263}
@@ -271,14 +266,14 @@ static game_params *custom_params(const config_item *cfg)
271{ 266{
272 game_params *ret = snew(game_params); 267 game_params *ret = snew(game_params);
273 268
274 ret->w = atoi(cfg[0].sval); 269 ret->w = atoi(cfg[0].u.string.sval);
275 ret->h = atoi(cfg[1].sval); 270 ret->h = atoi(cfg[1].u.string.sval);
276 ret->maxmoves = atoi(cfg[2].sval); 271 ret->maxmoves = atoi(cfg[2].u.string.sval);
277 272
278 return ret; 273 return ret;
279} 274}
280 275
281static char *validate_params(const game_params *params, int full) 276static const char *validate_params(const game_params *params, int full)
282{ 277{
283 if (params->w > MAXWID) 278 if (params->w > MAXWID)
284 return "Width must be at most " STR(MAXWID); 279 return "Width must be at most " STR(MAXWID);
@@ -891,7 +886,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
891 return ret; 886 return ret;
892} 887}
893 888
894static char *validate_desc(const game_params *params, const char *desc) 889static const char *validate_desc(const game_params *params, const char *desc)
895{ 890{
896 int w = params->w, h = params->h, wh = w*h; 891 int w = params->w, h = params->h, wh = w*h;
897 int *active, *link; 892 int *active, *link;
@@ -1126,7 +1121,7 @@ static void free_game(game_state *state)
1126} 1121}
1127 1122
1128static char *solve_game(const game_state *state, const game_state *currstate, 1123static char *solve_game(const game_state *state, const game_state *currstate,
1129 const char *aux, char **error) 1124 const char *aux, const char **error)
1130{ 1125{
1131 int *moves; 1126 int *moves;
1132 int nmoves; 1127 int nmoves;
@@ -1349,7 +1344,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1349 * And that's it. Update the display to reflect the start 1344 * And that's it. Update the display to reflect the start
1350 * of a drag. 1345 * of a drag.
1351 */ 1346 */
1352 return ""; 1347 return UI_UPDATE;
1353 } else if (button == LEFT_DRAG && ui->dragging) { 1348 } else if (button == LEFT_DRAG && ui->dragging) {
1354 int dist, distlimit, dx, dy, s, px, py; 1349 int dist, distlimit, dx, dy, s, px, py;
1355 1350
@@ -1376,7 +1371,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1376 if (px >= 0 && px < w && py >= 0 && py < h && 1371 if (px >= 0 && px < w && py >= 0 && py < h &&
1377 ui->reachable[py*w+px]) { 1372 ui->reachable[py*w+px]) {
1378 ui->drag_currpos = py*w+px; 1373 ui->drag_currpos = py*w+px;
1379 return ""; 1374 return UI_UPDATE;
1380 } 1375 }
1381 } 1376 }
1382 } 1377 }