diff options
author | Franklin Wei <git@fwei.tk> | 2017-10-23 17:19:29 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-10-23 17:19:29 -0400 |
commit | ef1306764e6443d67612542654f252b376c5993e (patch) | |
tree | 5f064178c1f9a23695b1b52b8bd487434be9006e /apps/plugins/puzzles/src/samegame.c | |
parent | 7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a (diff) | |
download | rockbox-ef1306764e6443d67612542654f252b376c5993e.tar.gz rockbox-ef1306764e6443d67612542654f252b376c5993e.zip |
puzzles: resync with upstream
There have been some improvements with regard to small screen sizes,
which will be nice to have.
Change-Id: I30c740514156258d2818fde325c1a751500f7611
Diffstat (limited to 'apps/plugins/puzzles/src/samegame.c')
-rw-r--r-- | apps/plugins/puzzles/src/samegame.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/apps/plugins/puzzles/src/samegame.c b/apps/plugins/puzzles/src/samegame.c index 88edad32b1..d7d06764bf 100644 --- a/apps/plugins/puzzles/src/samegame.c +++ b/apps/plugins/puzzles/src/samegame.c | |||
@@ -241,35 +241,29 @@ static config_item *game_configure(const game_params *params) | |||
241 | ret[0].name = "Width"; | 241 | ret[0].name = "Width"; |
242 | ret[0].type = C_STRING; | 242 | ret[0].type = C_STRING; |
243 | sprintf(buf, "%d", params->w); | 243 | sprintf(buf, "%d", params->w); |
244 | ret[0].sval = dupstr(buf); | 244 | ret[0].u.string.sval = dupstr(buf); |
245 | ret[0].ival = 0; | ||
246 | 245 | ||
247 | ret[1].name = "Height"; | 246 | ret[1].name = "Height"; |
248 | ret[1].type = C_STRING; | 247 | ret[1].type = C_STRING; |
249 | sprintf(buf, "%d", params->h); | 248 | sprintf(buf, "%d", params->h); |
250 | ret[1].sval = dupstr(buf); | 249 | ret[1].u.string.sval = dupstr(buf); |
251 | ret[1].ival = 0; | ||
252 | 250 | ||
253 | ret[2].name = "No. of colours"; | 251 | ret[2].name = "No. of colours"; |
254 | ret[2].type = C_STRING; | 252 | ret[2].type = C_STRING; |
255 | sprintf(buf, "%d", params->ncols); | 253 | sprintf(buf, "%d", params->ncols); |
256 | ret[2].sval = dupstr(buf); | 254 | ret[2].u.string.sval = dupstr(buf); |
257 | ret[2].ival = 0; | ||
258 | 255 | ||
259 | ret[3].name = "Scoring system"; | 256 | ret[3].name = "Scoring system"; |
260 | ret[3].type = C_CHOICES; | 257 | ret[3].type = C_CHOICES; |
261 | ret[3].sval = ":(n-1)^2:(n-2)^2"; | 258 | ret[3].u.choices.choicenames = ":(n-1)^2:(n-2)^2"; |
262 | ret[3].ival = params->scoresub-1; | 259 | ret[3].u.choices.selected = params->scoresub-1; |
263 | 260 | ||
264 | ret[4].name = "Ensure solubility"; | 261 | ret[4].name = "Ensure solubility"; |
265 | ret[4].type = C_BOOLEAN; | 262 | ret[4].type = C_BOOLEAN; |
266 | ret[4].sval = NULL; | 263 | ret[4].u.boolean.bval = params->soluble; |
267 | ret[4].ival = params->soluble; | ||
268 | 264 | ||
269 | ret[5].name = NULL; | 265 | ret[5].name = NULL; |
270 | ret[5].type = C_END; | 266 | ret[5].type = C_END; |
271 | ret[5].sval = NULL; | ||
272 | ret[5].ival = 0; | ||
273 | 267 | ||
274 | return ret; | 268 | return ret; |
275 | } | 269 | } |
@@ -278,16 +272,16 @@ static game_params *custom_params(const config_item *cfg) | |||
278 | { | 272 | { |
279 | game_params *ret = snew(game_params); | 273 | game_params *ret = snew(game_params); |
280 | 274 | ||
281 | ret->w = atoi(cfg[0].sval); | 275 | ret->w = atoi(cfg[0].u.string.sval); |
282 | ret->h = atoi(cfg[1].sval); | 276 | ret->h = atoi(cfg[1].u.string.sval); |
283 | ret->ncols = atoi(cfg[2].sval); | 277 | ret->ncols = atoi(cfg[2].u.string.sval); |
284 | ret->scoresub = cfg[3].ival + 1; | 278 | ret->scoresub = cfg[3].u.choices.selected + 1; |
285 | ret->soluble = cfg[4].ival; | 279 | ret->soluble = cfg[4].u.boolean.bval; |
286 | 280 | ||
287 | return ret; | 281 | return ret; |
288 | } | 282 | } |
289 | 283 | ||
290 | static char *validate_params(const game_params *params, int full) | 284 | static const char *validate_params(const game_params *params, int full) |
291 | { | 285 | { |
292 | if (params->w < 1 || params->h < 1) | 286 | if (params->w < 1 || params->h < 1) |
293 | return "Width and height must both be positive"; | 287 | return "Width and height must both be positive"; |
@@ -948,7 +942,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, | |||
948 | return ret; | 942 | return ret; |
949 | } | 943 | } |
950 | 944 | ||
951 | static char *validate_desc(const game_params *params, const char *desc) | 945 | static const char *validate_desc(const game_params *params, const char *desc) |
952 | { | 946 | { |
953 | int area = params->w * params->h, i; | 947 | int area = params->w * params->h, i; |
954 | const char *p = desc; | 948 | const char *p = desc; |
@@ -1018,7 +1012,7 @@ static void free_game(game_state *state) | |||
1018 | } | 1012 | } |
1019 | 1013 | ||
1020 | static char *solve_game(const game_state *state, const game_state *currstate, | 1014 | static char *solve_game(const game_state *state, const game_state *currstate, |
1021 | const char *aux, char **error) | 1015 | const char *aux, const char **error) |
1022 | { | 1016 | { |
1023 | return NULL; | 1017 | return NULL; |
1024 | } | 1018 | } |
@@ -1114,7 +1108,8 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, | |||
1114 | static char *sel_movedesc(game_ui *ui, const game_state *state) | 1108 | static char *sel_movedesc(game_ui *ui, const game_state *state) |
1115 | { | 1109 | { |
1116 | int i; | 1110 | int i; |
1117 | char *ret, *sep, buf[80]; | 1111 | char *ret, buf[80]; |
1112 | const char *sep; | ||
1118 | int retlen, retsize; | 1113 | int retlen, retsize; |
1119 | 1114 | ||
1120 | retsize = 256; | 1115 | retsize = 256; |
@@ -1273,7 +1268,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
1273 | int x, int y, int button) | 1268 | int x, int y, int button) |
1274 | { | 1269 | { |
1275 | int tx, ty; | 1270 | int tx, ty; |
1276 | char *ret = ""; | 1271 | char *ret = UI_UPDATE; |
1277 | 1272 | ||
1278 | ui->displaysel = 0; | 1273 | ui->displaysel = 0; |
1279 | 1274 | ||