diff options
Diffstat (limited to 'apps/plugins/puzzles/src/keen.c')
-rw-r--r-- | apps/plugins/puzzles/src/keen.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/apps/plugins/puzzles/src/keen.c b/apps/plugins/puzzles/src/keen.c index fdaae32e5d..ec7af12985 100644 --- a/apps/plugins/puzzles/src/keen.c +++ b/apps/plugins/puzzles/src/keen.c | |||
@@ -183,23 +183,19 @@ static config_item *game_configure(const game_params *params) | |||
183 | ret[0].name = "Grid size"; | 183 | ret[0].name = "Grid size"; |
184 | ret[0].type = C_STRING; | 184 | ret[0].type = C_STRING; |
185 | sprintf(buf, "%d", params->w); | 185 | sprintf(buf, "%d", params->w); |
186 | ret[0].sval = dupstr(buf); | 186 | ret[0].u.string.sval = dupstr(buf); |
187 | ret[0].ival = 0; | ||
188 | 187 | ||
189 | ret[1].name = "Difficulty"; | 188 | ret[1].name = "Difficulty"; |
190 | ret[1].type = C_CHOICES; | 189 | ret[1].type = C_CHOICES; |
191 | ret[1].sval = DIFFCONFIG; | 190 | ret[1].u.choices.choicenames = DIFFCONFIG; |
192 | ret[1].ival = params->diff; | 191 | ret[1].u.choices.selected = params->diff; |
193 | 192 | ||
194 | ret[2].name = "Multiplication only"; | 193 | ret[2].name = "Multiplication only"; |
195 | ret[2].type = C_BOOLEAN; | 194 | ret[2].type = C_BOOLEAN; |
196 | ret[2].sval = NULL; | 195 | ret[2].u.boolean.bval = params->multiplication_only; |
197 | ret[2].ival = params->multiplication_only; | ||
198 | 196 | ||
199 | ret[3].name = NULL; | 197 | ret[3].name = NULL; |
200 | ret[3].type = C_END; | 198 | ret[3].type = C_END; |
201 | ret[3].sval = NULL; | ||
202 | ret[3].ival = 0; | ||
203 | 199 | ||
204 | return ret; | 200 | return ret; |
205 | } | 201 | } |
@@ -208,14 +204,14 @@ static game_params *custom_params(const config_item *cfg) | |||
208 | { | 204 | { |
209 | game_params *ret = snew(game_params); | 205 | game_params *ret = snew(game_params); |
210 | 206 | ||
211 | ret->w = atoi(cfg[0].sval); | 207 | ret->w = atoi(cfg[0].u.string.sval); |
212 | ret->diff = cfg[1].ival; | 208 | ret->diff = cfg[1].u.choices.selected; |
213 | ret->multiplication_only = cfg[2].ival; | 209 | ret->multiplication_only = cfg[2].u.boolean.bval; |
214 | 210 | ||
215 | return ret; | 211 | return ret; |
216 | } | 212 | } |
217 | 213 | ||
218 | static char *validate_params(const game_params *params, int full) | 214 | static const char *validate_params(const game_params *params, int full) |
219 | { | 215 | { |
220 | if (params->w < 3 || params->w > 9) | 216 | if (params->w < 3 || params->w > 9) |
221 | return "Grid size must be between 3 and 9"; | 217 | return "Grid size must be between 3 and 9"; |
@@ -731,7 +727,7 @@ static char *encode_block_structure(char *p, int w, int *dsf) | |||
731 | return q; | 727 | return q; |
732 | } | 728 | } |
733 | 729 | ||
734 | static char *parse_block_structure(const char **p, int w, int *dsf) | 730 | static const char *parse_block_structure(const char **p, int w, int *dsf) |
735 | { | 731 | { |
736 | int a = w*w; | 732 | int a = w*w; |
737 | int pos = 0; | 733 | int pos = 0; |
@@ -1207,11 +1203,11 @@ done | |||
1207 | * Gameplay. | 1203 | * Gameplay. |
1208 | */ | 1204 | */ |
1209 | 1205 | ||
1210 | static char *validate_desc(const game_params *params, const char *desc) | 1206 | static const char *validate_desc(const game_params *params, const char *desc) |
1211 | { | 1207 | { |
1212 | int w = params->w, a = w*w; | 1208 | int w = params->w, a = w*w; |
1213 | int *dsf; | 1209 | int *dsf; |
1214 | char *ret; | 1210 | const char *ret; |
1215 | const char *p = desc; | 1211 | const char *p = desc; |
1216 | int i; | 1212 | int i; |
1217 | 1213 | ||
@@ -1349,7 +1345,7 @@ static void free_game(game_state *state) | |||
1349 | } | 1345 | } |
1350 | 1346 | ||
1351 | static char *solve_game(const game_state *state, const game_state *currstate, | 1347 | static char *solve_game(const game_state *state, const game_state *currstate, |
1352 | const char *aux, char **error) | 1348 | const char *aux, const char **error) |
1353 | { | 1349 | { |
1354 | int w = state->par.w, a = w*w; | 1350 | int w = state->par.w, a = w*w; |
1355 | int i, ret; | 1351 | int i, ret; |
@@ -1616,7 +1612,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1616 | ui->hpencil = 0; | 1612 | ui->hpencil = 0; |
1617 | } | 1613 | } |
1618 | ui->hcursor = 0; | 1614 | ui->hcursor = 0; |
1619 | return ""; /* UI activity occurred */ | 1615 | return UI_UPDATE; |
1620 | } | 1616 | } |
1621 | if (button == RIGHT_BUTTON) { | 1617 | if (button == RIGHT_BUTTON) { |
1622 | /* | 1618 | /* |
@@ -1636,19 +1632,19 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1636 | ui->hshow = 0; | 1632 | ui->hshow = 0; |
1637 | } | 1633 | } |
1638 | ui->hcursor = 0; | 1634 | ui->hcursor = 0; |
1639 | return ""; /* UI activity occurred */ | 1635 | return UI_UPDATE; |
1640 | } | 1636 | } |
1641 | } | 1637 | } |
1642 | if (IS_CURSOR_MOVE(button)) { | 1638 | if (IS_CURSOR_MOVE(button)) { |
1643 | move_cursor(button, &ui->hx, &ui->hy, w, w, 0); | 1639 | move_cursor(button, &ui->hx, &ui->hy, w, w, 0); |
1644 | ui->hshow = ui->hcursor = 1; | 1640 | ui->hshow = ui->hcursor = 1; |
1645 | return ""; | 1641 | return UI_UPDATE; |
1646 | } | 1642 | } |
1647 | if (ui->hshow && | 1643 | if (ui->hshow && |
1648 | (button == CURSOR_SELECT)) { | 1644 | (button == CURSOR_SELECT)) { |
1649 | ui->hpencil = 1 - ui->hpencil; | 1645 | ui->hpencil = 1 - ui->hpencil; |
1650 | ui->hcursor = 1; | 1646 | ui->hcursor = 1; |
1651 | return ""; | 1647 | return UI_UPDATE; |
1652 | } | 1648 | } |
1653 | 1649 | ||
1654 | if (ui->hshow && | 1650 | if (ui->hshow && |
@@ -2383,7 +2379,8 @@ int main(int argc, char **argv) | |||
2383 | { | 2379 | { |
2384 | game_params *p; | 2380 | game_params *p; |
2385 | game_state *s; | 2381 | game_state *s; |
2386 | char *id = NULL, *desc, *err; | 2382 | char *id = NULL, *desc; |
2383 | const char *err; | ||
2387 | int grade = FALSE; | 2384 | int grade = FALSE; |
2388 | int ret, diff, really_show_working = FALSE; | 2385 | int ret, diff, really_show_working = FALSE; |
2389 | 2386 | ||