diff options
Diffstat (limited to 'apps/plugins/puzzles/src/towers.c')
-rw-r--r-- | apps/plugins/puzzles/src/towers.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/apps/plugins/puzzles/src/towers.c b/apps/plugins/puzzles/src/towers.c index a3a7e55a45..9ccc6ae185 100644 --- a/apps/plugins/puzzles/src/towers.c +++ b/apps/plugins/puzzles/src/towers.c | |||
@@ -212,18 +212,15 @@ static config_item *game_configure(const game_params *params) | |||
212 | ret[0].name = "Grid size"; | 212 | ret[0].name = "Grid size"; |
213 | ret[0].type = C_STRING; | 213 | ret[0].type = C_STRING; |
214 | sprintf(buf, "%d", params->w); | 214 | sprintf(buf, "%d", params->w); |
215 | ret[0].sval = dupstr(buf); | 215 | ret[0].u.string.sval = dupstr(buf); |
216 | ret[0].ival = 0; | ||
217 | 216 | ||
218 | ret[1].name = "Difficulty"; | 217 | ret[1].name = "Difficulty"; |
219 | ret[1].type = C_CHOICES; | 218 | ret[1].type = C_CHOICES; |
220 | ret[1].sval = DIFFCONFIG; | 219 | ret[1].u.choices.choicenames = DIFFCONFIG; |
221 | ret[1].ival = params->diff; | 220 | ret[1].u.choices.selected = params->diff; |
222 | 221 | ||
223 | ret[2].name = NULL; | 222 | ret[2].name = NULL; |
224 | ret[2].type = C_END; | 223 | ret[2].type = C_END; |
225 | ret[2].sval = NULL; | ||
226 | ret[2].ival = 0; | ||
227 | 224 | ||
228 | return ret; | 225 | return ret; |
229 | } | 226 | } |
@@ -232,13 +229,13 @@ static game_params *custom_params(const config_item *cfg) | |||
232 | { | 229 | { |
233 | game_params *ret = snew(game_params); | 230 | game_params *ret = snew(game_params); |
234 | 231 | ||
235 | ret->w = atoi(cfg[0].sval); | 232 | ret->w = atoi(cfg[0].u.string.sval); |
236 | ret->diff = cfg[1].ival; | 233 | ret->diff = cfg[1].u.choices.selected; |
237 | 234 | ||
238 | return ret; | 235 | return ret; |
239 | } | 236 | } |
240 | 237 | ||
241 | static char *validate_params(const game_params *params, int full) | 238 | static const char *validate_params(const game_params *params, int full) |
242 | { | 239 | { |
243 | if (params->w < 3 || params->w > 9) | 240 | if (params->w < 3 || params->w > 9) |
244 | return "Grid size must be between 3 and 9"; | 241 | return "Grid size must be between 3 and 9"; |
@@ -802,7 +799,7 @@ done | |||
802 | * Gameplay. | 799 | * Gameplay. |
803 | */ | 800 | */ |
804 | 801 | ||
805 | static char *validate_desc(const game_params *params, const char *desc) | 802 | static const char *validate_desc(const game_params *params, const char *desc) |
806 | { | 803 | { |
807 | int w = params->w, a = w*w; | 804 | int w = params->w, a = w*w; |
808 | const char *p = desc; | 805 | const char *p = desc; |
@@ -970,7 +967,7 @@ static void free_game(game_state *state) | |||
970 | } | 967 | } |
971 | 968 | ||
972 | static char *solve_game(const game_state *state, const game_state *currstate, | 969 | static char *solve_game(const game_state *state, const game_state *currstate, |
973 | const char *aux, char **error) | 970 | const char *aux, const char **error) |
974 | { | 971 | { |
975 | int w = state->par.w, a = w*w; | 972 | int w = state->par.w, a = w*w; |
976 | int i, ret; | 973 | int i, ret; |
@@ -1349,7 +1346,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1349 | ui->hpencil = 0; | 1346 | ui->hpencil = 0; |
1350 | } | 1347 | } |
1351 | ui->hcursor = 0; | 1348 | ui->hcursor = 0; |
1352 | return ""; /* UI activity occurred */ | 1349 | return UI_UPDATE; |
1353 | } | 1350 | } |
1354 | if (button == RIGHT_BUTTON) { | 1351 | if (button == RIGHT_BUTTON) { |
1355 | /* | 1352 | /* |
@@ -1369,7 +1366,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1369 | ui->hshow = 0; | 1366 | ui->hshow = 0; |
1370 | } | 1367 | } |
1371 | ui->hcursor = 0; | 1368 | ui->hcursor = 0; |
1372 | return ""; /* UI activity occurred */ | 1369 | return UI_UPDATE; |
1373 | } | 1370 | } |
1374 | } else if (button == LEFT_BUTTON) { | 1371 | } else if (button == LEFT_BUTTON) { |
1375 | if (is_clue(state, tx, ty)) { | 1372 | if (is_clue(state, tx, ty)) { |
@@ -1394,13 +1391,13 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1394 | } | 1391 | } |
1395 | move_cursor(button, &ui->hx, &ui->hy, w, w, 0); | 1392 | move_cursor(button, &ui->hx, &ui->hy, w, w, 0); |
1396 | ui->hshow = ui->hcursor = 1; | 1393 | ui->hshow = ui->hcursor = 1; |
1397 | return ""; | 1394 | return UI_UPDATE; |
1398 | } | 1395 | } |
1399 | if (ui->hshow && | 1396 | if (ui->hshow && |
1400 | (button == CURSOR_SELECT)) { | 1397 | (button == CURSOR_SELECT)) { |
1401 | ui->hpencil = 1 - ui->hpencil; | 1398 | ui->hpencil = 1 - ui->hpencil; |
1402 | ui->hcursor = 1; | 1399 | ui->hcursor = 1; |
1403 | return ""; | 1400 | return UI_UPDATE; |
1404 | } | 1401 | } |
1405 | 1402 | ||
1406 | if (ui->hshow && | 1403 | if (ui->hshow && |
@@ -2021,7 +2018,8 @@ int main(int argc, char **argv) | |||
2021 | { | 2018 | { |
2022 | game_params *p; | 2019 | game_params *p; |
2023 | game_state *s; | 2020 | game_state *s; |
2024 | char *id = NULL, *desc, *err; | 2021 | char *id = NULL, *desc; |
2022 | const char *err; | ||
2025 | int grade = FALSE; | 2023 | int grade = FALSE; |
2026 | int ret, diff, really_show_working = FALSE; | 2024 | int ret, diff, really_show_working = FALSE; |
2027 | 2025 | ||