diff options
Diffstat (limited to 'apps/plugins/puzzles/src/dominosa.c')
-rw-r--r-- | apps/plugins/puzzles/src/dominosa.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/apps/plugins/puzzles/src/dominosa.c b/apps/plugins/puzzles/src/dominosa.c index c86ba19dfa..a072ac6168 100644 --- a/apps/plugins/puzzles/src/dominosa.c +++ b/apps/plugins/puzzles/src/dominosa.c | |||
@@ -169,18 +169,14 @@ static config_item *game_configure(const game_params *params) | |||
169 | ret[0].name = "Maximum number on dominoes"; | 169 | ret[0].name = "Maximum number on dominoes"; |
170 | ret[0].type = C_STRING; | 170 | ret[0].type = C_STRING; |
171 | sprintf(buf, "%d", params->n); | 171 | sprintf(buf, "%d", params->n); |
172 | ret[0].sval = dupstr(buf); | 172 | ret[0].u.string.sval = dupstr(buf); |
173 | ret[0].ival = 0; | ||
174 | 173 | ||
175 | ret[1].name = "Ensure unique solution"; | 174 | ret[1].name = "Ensure unique solution"; |
176 | ret[1].type = C_BOOLEAN; | 175 | ret[1].type = C_BOOLEAN; |
177 | ret[1].sval = NULL; | 176 | ret[1].u.boolean.bval = params->unique; |
178 | ret[1].ival = params->unique; | ||
179 | 177 | ||
180 | ret[2].name = NULL; | 178 | ret[2].name = NULL; |
181 | ret[2].type = C_END; | 179 | ret[2].type = C_END; |
182 | ret[2].sval = NULL; | ||
183 | ret[2].ival = 0; | ||
184 | 180 | ||
185 | return ret; | 181 | return ret; |
186 | } | 182 | } |
@@ -189,13 +185,13 @@ static game_params *custom_params(const config_item *cfg) | |||
189 | { | 185 | { |
190 | game_params *ret = snew(game_params); | 186 | game_params *ret = snew(game_params); |
191 | 187 | ||
192 | ret->n = atoi(cfg[0].sval); | 188 | ret->n = atoi(cfg[0].u.string.sval); |
193 | ret->unique = cfg[1].ival; | 189 | ret->unique = cfg[1].u.boolean.bval; |
194 | 190 | ||
195 | return ret; | 191 | return ret; |
196 | } | 192 | } |
197 | 193 | ||
198 | static char *validate_params(const game_params *params, int full) | 194 | static const char *validate_params(const game_params *params, int full) |
199 | { | 195 | { |
200 | if (params->n < 1) | 196 | if (params->n < 1) |
201 | return "Maximum face number must be at least one"; | 197 | return "Maximum face number must be at least one"; |
@@ -748,12 +744,12 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
748 | return ret; | 744 | return ret; |
749 | } | 745 | } |
750 | 746 | ||
751 | static char *validate_desc(const game_params *params, const char *desc) | 747 | static const char *validate_desc(const game_params *params, const char *desc) |
752 | { | 748 | { |
753 | int n = params->n, w = n+2, h = n+1, wh = w*h; | 749 | int n = params->n, w = n+2, h = n+1, wh = w*h; |
754 | int *occurrences; | 750 | int *occurrences; |
755 | int i, j; | 751 | int i, j; |
756 | char *ret; | 752 | const char *ret; |
757 | 753 | ||
758 | ret = NULL; | 754 | ret = NULL; |
759 | occurrences = snewn(n+1, int); | 755 | occurrences = snewn(n+1, int); |
@@ -875,7 +871,7 @@ static void free_game(game_state *state) | |||
875 | } | 871 | } |
876 | 872 | ||
877 | static char *solve_game(const game_state *state, const game_state *currstate, | 873 | static char *solve_game(const game_state *state, const game_state *currstate, |
878 | const char *aux, char **error) | 874 | const char *aux, const char **error) |
879 | { | 875 | { |
880 | int n = state->params.n, w = n+2, h = n+1, wh = w*h; | 876 | int n = state->params.n, w = n+2, h = n+1, wh = w*h; |
881 | int *placements; | 877 | int *placements; |
@@ -1119,7 +1115,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1119 | 1115 | ||
1120 | move_cursor(button, &ui->cur_x, &ui->cur_y, 2*w-1, 2*h-1, 0); | 1116 | move_cursor(button, &ui->cur_x, &ui->cur_y, 2*w-1, 2*h-1, 0); |
1121 | 1117 | ||
1122 | return ""; | 1118 | return UI_UPDATE; |
1123 | } else if (IS_CURSOR_SELECT(button)) { | 1119 | } else if (IS_CURSOR_SELECT(button)) { |
1124 | int d1, d2; | 1120 | int d1, d2; |
1125 | 1121 | ||
@@ -1152,7 +1148,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1152 | } else { | 1148 | } else { |
1153 | return NULL; | 1149 | return NULL; |
1154 | } | 1150 | } |
1155 | return ""; | 1151 | return UI_UPDATE; |
1156 | } | 1152 | } |
1157 | 1153 | ||
1158 | return NULL; | 1154 | return NULL; |