summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/untangle.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/untangle.c')
-rw-r--r--apps/plugins/puzzles/src/untangle.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/plugins/puzzles/src/untangle.c b/apps/plugins/puzzles/src/untangle.c
index 441c8658ce..6c2eb30deb 100644
--- a/apps/plugins/puzzles/src/untangle.c
+++ b/apps/plugins/puzzles/src/untangle.c
@@ -187,13 +187,10 @@ static config_item *game_configure(const game_params *params)
187 ret[0].name = "Number of points"; 187 ret[0].name = "Number of points";
188 ret[0].type = C_STRING; 188 ret[0].type = C_STRING;
189 sprintf(buf, "%d", params->n); 189 sprintf(buf, "%d", params->n);
190 ret[0].sval = dupstr(buf); 190 ret[0].u.string.sval = dupstr(buf);
191 ret[0].ival = 0;
192 191
193 ret[1].name = NULL; 192 ret[1].name = NULL;
194 ret[1].type = C_END; 193 ret[1].type = C_END;
195 ret[1].sval = NULL;
196 ret[1].ival = 0;
197 194
198 return ret; 195 return ret;
199} 196}
@@ -202,12 +199,12 @@ static game_params *custom_params(const config_item *cfg)
202{ 199{
203 game_params *ret = snew(game_params); 200 game_params *ret = snew(game_params);
204 201
205 ret->n = atoi(cfg[0].sval); 202 ret->n = atoi(cfg[0].u.string.sval);
206 203
207 return ret; 204 return ret;
208} 205}
209 206
210static char *validate_params(const game_params *params, int full) 207static const char *validate_params(const game_params *params, int full)
211{ 208{
212 if (params->n < 4) 209 if (params->n < 4)
213 return "Number of points must be at least four"; 210 return "Number of points must be at least four";
@@ -661,7 +658,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
661 */ 658 */
662 ret = NULL; 659 ret = NULL;
663 { 660 {
664 char *sep; 661 const char *sep;
665 char buf[80]; 662 char buf[80];
666 int retlen; 663 int retlen;
667 edge *ea; 664 edge *ea;
@@ -736,7 +733,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
736 return ret; 733 return ret;
737} 734}
738 735
739static char *validate_desc(const game_params *params, const char *desc) 736static const char *validate_desc(const game_params *params, const char *desc)
740{ 737{
741 int a, b; 738 int a, b;
742 739
@@ -883,7 +880,7 @@ static void free_game(game_state *state)
883} 880}
884 881
885static char *solve_game(const game_state *state, const game_state *currstate, 882static char *solve_game(const game_state *state, const game_state *currstate,
886 const char *aux, char **error) 883 const char *aux, const char **error)
887{ 884{
888 int n = state->params.n; 885 int n = state->params.n;
889 int matrix[4]; 886 int matrix[4];
@@ -1126,14 +1123,14 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1126 ui->newpoint.x = x; 1123 ui->newpoint.x = x;
1127 ui->newpoint.y = y; 1124 ui->newpoint.y = y;
1128 ui->newpoint.d = ds->tilesize; 1125 ui->newpoint.d = ds->tilesize;
1129 return ""; 1126 return UI_UPDATE;
1130 } 1127 }
1131 1128
1132 } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) { 1129 } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) {
1133 ui->newpoint.x = x; 1130 ui->newpoint.x = x;
1134 ui->newpoint.y = y; 1131 ui->newpoint.y = y;
1135 ui->newpoint.d = ds->tilesize; 1132 ui->newpoint.d = ds->tilesize;
1136 return ""; 1133 return UI_UPDATE;
1137 } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) { 1134 } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) {
1138 int p = ui->dragpoint; 1135 int p = ui->dragpoint;
1139 char buf[80]; 1136 char buf[80];
@@ -1148,7 +1145,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1148 ui->newpoint.x >= (long)state->w*ui->newpoint.d || 1145 ui->newpoint.x >= (long)state->w*ui->newpoint.d ||
1149 ui->newpoint.y < 0 || 1146 ui->newpoint.y < 0 ||
1150 ui->newpoint.y >= (long)state->h*ui->newpoint.d) 1147 ui->newpoint.y >= (long)state->h*ui->newpoint.d)
1151 return ""; 1148 return UI_UPDATE;
1152 1149
1153 /* 1150 /*
1154 * We aren't cancelling the drag. Construct a move string 1151 * We aren't cancelling the drag. Construct a move string