diff options
Diffstat (limited to 'apps/plugins/puzzles/src/flood.c')
-rw-r--r-- | apps/plugins/puzzles/src/flood.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/apps/plugins/puzzles/src/flood.c b/apps/plugins/puzzles/src/flood.c index 59e160cfc3..854469a49a 100644 --- a/apps/plugins/puzzles/src/flood.c +++ b/apps/plugins/puzzles/src/flood.c | |||
@@ -170,31 +170,25 @@ static config_item *game_configure(const game_params *params) | |||
170 | ret[0].name = "Width"; | 170 | ret[0].name = "Width"; |
171 | ret[0].type = C_STRING; | 171 | ret[0].type = C_STRING; |
172 | sprintf(buf, "%d", params->w); | 172 | sprintf(buf, "%d", params->w); |
173 | ret[0].sval = dupstr(buf); | 173 | ret[0].u.string.sval = dupstr(buf); |
174 | ret[0].ival = 0; | ||
175 | 174 | ||
176 | ret[1].name = "Height"; | 175 | ret[1].name = "Height"; |
177 | ret[1].type = C_STRING; | 176 | ret[1].type = C_STRING; |
178 | sprintf(buf, "%d", params->h); | 177 | sprintf(buf, "%d", params->h); |
179 | ret[1].sval = dupstr(buf); | 178 | ret[1].u.string.sval = dupstr(buf); |
180 | ret[1].ival = 0; | ||
181 | 179 | ||
182 | ret[2].name = "Colours"; | 180 | ret[2].name = "Colours"; |
183 | ret[2].type = C_STRING; | 181 | ret[2].type = C_STRING; |
184 | sprintf(buf, "%d", params->colours); | 182 | sprintf(buf, "%d", params->colours); |
185 | ret[2].sval = dupstr(buf); | 183 | ret[2].u.string.sval = dupstr(buf); |
186 | ret[2].ival = 0; | ||
187 | 184 | ||
188 | ret[3].name = "Extra moves permitted"; | 185 | ret[3].name = "Extra moves permitted"; |
189 | ret[3].type = C_STRING; | 186 | ret[3].type = C_STRING; |
190 | sprintf(buf, "%d", params->leniency); | 187 | sprintf(buf, "%d", params->leniency); |
191 | ret[3].sval = dupstr(buf); | 188 | ret[3].u.string.sval = dupstr(buf); |
192 | ret[3].ival = 0; | ||
193 | 189 | ||
194 | ret[4].name = NULL; | 190 | ret[4].name = NULL; |
195 | ret[4].type = C_END; | 191 | ret[4].type = C_END; |
196 | ret[4].sval = NULL; | ||
197 | ret[4].ival = 0; | ||
198 | 192 | ||
199 | return ret; | 193 | return ret; |
200 | } | 194 | } |
@@ -203,15 +197,15 @@ static game_params *custom_params(const config_item *cfg) | |||
203 | { | 197 | { |
204 | game_params *ret = snew(game_params); | 198 | game_params *ret = snew(game_params); |
205 | 199 | ||
206 | ret->w = atoi(cfg[0].sval); | 200 | ret->w = atoi(cfg[0].u.string.sval); |
207 | ret->h = atoi(cfg[1].sval); | 201 | ret->h = atoi(cfg[1].u.string.sval); |
208 | ret->colours = atoi(cfg[2].sval); | 202 | ret->colours = atoi(cfg[2].u.string.sval); |
209 | ret->leniency = atoi(cfg[3].sval); | 203 | ret->leniency = atoi(cfg[3].u.string.sval); |
210 | 204 | ||
211 | return ret; | 205 | return ret; |
212 | } | 206 | } |
213 | 207 | ||
214 | static char *validate_params(const game_params *params, int full) | 208 | static const char *validate_params(const game_params *params, int full) |
215 | { | 209 | { |
216 | if (params->w * params->h < 2) | 210 | if (params->w * params->h < 2) |
217 | return "Grid must contain at least two squares"; | 211 | return "Grid must contain at least two squares"; |
@@ -597,7 +591,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
597 | return desc; | 591 | return desc; |
598 | } | 592 | } |
599 | 593 | ||
600 | static char *validate_desc(const game_params *params, const char *desc) | 594 | static const char *validate_desc(const game_params *params, const char *desc) |
601 | { | 595 | { |
602 | int w = params->w, h = params->h, wh = w*h; | 596 | int w = params->w, h = params->h, wh = w*h; |
603 | int i; | 597 | int i; |
@@ -691,7 +685,7 @@ static void free_game(game_state *state) | |||
691 | } | 685 | } |
692 | 686 | ||
693 | static char *solve_game(const game_state *state, const game_state *currstate, | 687 | static char *solve_game(const game_state *state, const game_state *currstate, |
694 | const char *aux, char **error) | 688 | const char *aux, const char **error) |
695 | { | 689 | { |
696 | int w = state->w, h = state->h, wh = w*h; | 690 | int w = state->w, h = state->h, wh = w*h; |
697 | char *moves, *ret, *p; | 691 | char *moves, *ret, *p; |
@@ -832,19 +826,19 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
832 | } else if (button == CURSOR_LEFT && ui->cx > 0) { | 826 | } else if (button == CURSOR_LEFT && ui->cx > 0) { |
833 | ui->cx--; | 827 | ui->cx--; |
834 | ui->cursor_visible = TRUE; | 828 | ui->cursor_visible = TRUE; |
835 | return ""; | 829 | return UI_UPDATE; |
836 | } else if (button == CURSOR_RIGHT && ui->cx+1 < w) { | 830 | } else if (button == CURSOR_RIGHT && ui->cx+1 < w) { |
837 | ui->cx++; | 831 | ui->cx++; |
838 | ui->cursor_visible = TRUE; | 832 | ui->cursor_visible = TRUE; |
839 | return ""; | 833 | return UI_UPDATE; |
840 | } else if (button == CURSOR_UP && ui->cy > 0) { | 834 | } else if (button == CURSOR_UP && ui->cy > 0) { |
841 | ui->cy--; | 835 | ui->cy--; |
842 | ui->cursor_visible = TRUE; | 836 | ui->cursor_visible = TRUE; |
843 | return ""; | 837 | return UI_UPDATE; |
844 | } else if (button == CURSOR_DOWN && ui->cy+1 < h) { | 838 | } else if (button == CURSOR_DOWN && ui->cy+1 < h) { |
845 | ui->cy++; | 839 | ui->cy++; |
846 | ui->cursor_visible = TRUE; | 840 | ui->cursor_visible = TRUE; |
847 | return ""; | 841 | return UI_UPDATE; |
848 | } else if (button == CURSOR_SELECT) { | 842 | } else if (button == CURSOR_SELECT) { |
849 | tx = ui->cx; | 843 | tx = ui->cx; |
850 | ty = ui->cy; | 844 | ty = ui->cy; |