diff options
Diffstat (limited to 'apps/plugins/puzzles/src/sixteen.c')
-rw-r--r-- | apps/plugins/puzzles/src/sixteen.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/apps/plugins/puzzles/src/sixteen.c b/apps/plugins/puzzles/src/sixteen.c index aaf524a0d6..9fa7032f02 100644 --- a/apps/plugins/puzzles/src/sixteen.c +++ b/apps/plugins/puzzles/src/sixteen.c | |||
@@ -140,25 +140,20 @@ static config_item *game_configure(const game_params *params) | |||
140 | ret[0].name = "Width"; | 140 | ret[0].name = "Width"; |
141 | ret[0].type = C_STRING; | 141 | ret[0].type = C_STRING; |
142 | sprintf(buf, "%d", params->w); | 142 | sprintf(buf, "%d", params->w); |
143 | ret[0].sval = dupstr(buf); | 143 | ret[0].u.string.sval = dupstr(buf); |
144 | ret[0].ival = 0; | ||
145 | 144 | ||
146 | ret[1].name = "Height"; | 145 | ret[1].name = "Height"; |
147 | ret[1].type = C_STRING; | 146 | ret[1].type = C_STRING; |
148 | sprintf(buf, "%d", params->h); | 147 | sprintf(buf, "%d", params->h); |
149 | ret[1].sval = dupstr(buf); | 148 | ret[1].u.string.sval = dupstr(buf); |
150 | ret[1].ival = 0; | ||
151 | 149 | ||
152 | ret[2].name = "Number of shuffling moves"; | 150 | ret[2].name = "Number of shuffling moves"; |
153 | ret[2].type = C_STRING; | 151 | ret[2].type = C_STRING; |
154 | sprintf(buf, "%d", params->movetarget); | 152 | sprintf(buf, "%d", params->movetarget); |
155 | ret[2].sval = dupstr(buf); | 153 | ret[2].u.string.sval = dupstr(buf); |
156 | ret[2].ival = 0; | ||
157 | 154 | ||
158 | ret[3].name = NULL; | 155 | ret[3].name = NULL; |
159 | ret[3].type = C_END; | 156 | ret[3].type = C_END; |
160 | ret[3].sval = NULL; | ||
161 | ret[3].ival = 0; | ||
162 | 157 | ||
163 | return ret; | 158 | return ret; |
164 | } | 159 | } |
@@ -167,14 +162,14 @@ static game_params *custom_params(const config_item *cfg) | |||
167 | { | 162 | { |
168 | game_params *ret = snew(game_params); | 163 | game_params *ret = snew(game_params); |
169 | 164 | ||
170 | ret->w = atoi(cfg[0].sval); | 165 | ret->w = atoi(cfg[0].u.string.sval); |
171 | ret->h = atoi(cfg[1].sval); | 166 | ret->h = atoi(cfg[1].u.string.sval); |
172 | ret->movetarget = atoi(cfg[2].sval); | 167 | ret->movetarget = atoi(cfg[2].u.string.sval); |
173 | 168 | ||
174 | return ret; | 169 | return ret; |
175 | } | 170 | } |
176 | 171 | ||
177 | static char *validate_params(const game_params *params, int full) | 172 | static const char *validate_params(const game_params *params, int full) |
178 | { | 173 | { |
179 | if (params->w < 2 || params->h < 2) | 174 | if (params->w < 2 || params->h < 2) |
180 | return "Width and height must both be at least two"; | 175 | return "Width and height must both be at least two"; |
@@ -402,10 +397,9 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
402 | } | 397 | } |
403 | 398 | ||
404 | 399 | ||
405 | static char *validate_desc(const game_params *params, const char *desc) | 400 | static const char *validate_desc(const game_params *params, const char *desc) |
406 | { | 401 | { |
407 | const char *p; | 402 | const char *p, *err; |
408 | char *err; | ||
409 | int i, area; | 403 | int i, area; |
410 | int *used; | 404 | int *used; |
411 | 405 | ||
@@ -510,7 +504,7 @@ static void free_game(game_state *state) | |||
510 | } | 504 | } |
511 | 505 | ||
512 | static char *solve_game(const game_state *state, const game_state *currstate, | 506 | static char *solve_game(const game_state *state, const game_state *currstate, |
513 | const char *aux, char **error) | 507 | const char *aux, const char **error) |
514 | { | 508 | { |
515 | return dupstr("S"); | 509 | return dupstr("S"); |
516 | } | 510 | } |
@@ -619,7 +613,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
619 | if (IS_CURSOR_MOVE(button) || pad) { | 613 | if (IS_CURSOR_MOVE(button) || pad) { |
620 | if (!ui->cur_visible) { | 614 | if (!ui->cur_visible) { |
621 | ui->cur_visible = 1; | 615 | ui->cur_visible = 1; |
622 | return ""; | 616 | return UI_UPDATE; |
623 | } | 617 | } |
624 | 618 | ||
625 | if (control || shift || ui->cur_mode) { | 619 | if (control || shift || ui->cur_mode) { |
@@ -674,7 +668,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
674 | } | 668 | } |
675 | 669 | ||
676 | ui->cur_visible = 1; | 670 | ui->cur_visible = 1; |
677 | return ""; | 671 | return UI_UPDATE; |
678 | } | 672 | } |
679 | } | 673 | } |
680 | 674 | ||
@@ -692,11 +686,11 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
692 | const enum cursor_mode m = (button == CURSOR_SELECT2 ? | 686 | const enum cursor_mode m = (button == CURSOR_SELECT2 ? |
693 | lock_position : lock_tile); | 687 | lock_position : lock_tile); |
694 | ui->cur_mode = (ui->cur_mode == m ? unlocked : m); | 688 | ui->cur_mode = (ui->cur_mode == m ? unlocked : m); |
695 | return ""; | 689 | return UI_UPDATE; |
696 | } | 690 | } |
697 | } else { | 691 | } else { |
698 | ui->cur_visible = 1; | 692 | ui->cur_visible = 1; |
699 | return ""; | 693 | return UI_UPDATE; |
700 | } | 694 | } |
701 | } else { | 695 | } else { |
702 | return NULL; | 696 | return NULL; |
@@ -711,7 +705,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
711 | else if (cy == state->h && cx >= 0 && cx < state->w) | 705 | else if (cy == state->h && cx >= 0 && cx < state->w) |
712 | dy = +1, dx = 0; | 706 | dy = +1, dx = 0; |
713 | else | 707 | else |
714 | return ""; /* invalid click location */ | 708 | return UI_UPDATE; /* invalid click location */ |
715 | 709 | ||
716 | /* reverse direction if right hand button is pressed */ | 710 | /* reverse direction if right hand button is pressed */ |
717 | if (button == RIGHT_BUTTON || button == CURSOR_SELECT2) { | 711 | if (button == RIGHT_BUTTON || button == CURSOR_SELECT2) { |