`Solve' operation on an already solved map without an aux_info was

returning NULL due to no moves being required, leading to a strange
error message. Trivial fix.

[originally from svn r6198]
This commit is contained in:
Simon Tatham
2005-08-22 09:27:52 +00:00
parent cd76bfb25f
commit b0614e6da8

9
map.c
View File

@ -1563,8 +1563,10 @@ static char *solve_game(game_state *state, game_state *currstate,
return NULL;
}
retlen = retsize = 0;
ret = NULL;
retsize = 64;
ret = snewn(retsize, char);
strcpy(ret, "S");
retlen = 1;
for (i = 0; i < state->map->n; i++) {
int len;
@ -1574,8 +1576,7 @@ static char *solve_game(game_state *state, game_state *currstate,
continue;
assert(!state->map->immutable[i]);
len = sprintf(buf, "%s%d:%d", retlen ? ";" : "S;",
colouring[i], i);
len = sprintf(buf, ";%d:%d", colouring[i], i);
if (retlen + len >= retsize) {
retsize = retlen + len + 256;
ret = sresize(ret, retsize, char);