Allow --save to work with --soln, causing saved game files to be

written out with the Solve operation having already been performed.

[originally from svn r9375]
This commit is contained in:
Simon Tatham
2011-12-28 18:17:30 +00:00
parent b5cb02b61a
commit 7024735f89
2 changed files with 12 additions and 1 deletions

10
gtk.c
View File

@ -2698,6 +2698,16 @@ int main(int argc, char **argv)
char *realname = snewn(40 + strlen(savefile) +
strlen(savesuffix), char);
sprintf(realname, "%s%d%s", savefile, i, savesuffix);
if (soln) {
char *err = midend_solve(me);
if (err) {
fprintf(stderr, "%s: unable to show solution: %s\n",
realname, err);
return 1;
}
}
ctx.fp = fopen(realname, "w");
if (!ctx.fp) {
fprintf(stderr, "%s: open: %s\n", realname,