chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5cb02b
)
Allow --save to work with --soln, causing saved game files to be
author
Simon Tatham
<anakin@pobox.com>
Wed, 28 Dec 2011 18:17:30 +0000
(18:17 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Wed, 28 Dec 2011 18:17:30 +0000
(18:17 +0000)
written out with the Solve operation having already been performed.
[originally from svn r9375]
gtk.c
patch
|
blob
|
history
midend.c
patch
|
blob
|
history
diff --git
a/gtk.c
b/gtk.c
index d45a76d29bd19107dddd261cf19b165d8872a586..c156651ca5805dce3e3d81dacf7aed9d82c98c9d 100644
(file)
--- a/
gtk.c
+++ b/
gtk.c
@@
-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,
diff --git
a/midend.c
b/midend.c
index 8f4e4c98bf5eb9c2a5abdf605b9b9704a4cd5b9a..c1f3a013f3c9dd5ee676d69362058180c49f0bdb 100644
(file)
--- a/
midend.c
+++ b/
midend.c
@@
-1331,7
+1331,8
@@
char *midend_solve(midend *me)
me->anim_time = 0.0;
midend_finish_move(me);
}
- midend_redraw(me);
+ if (me->drawing)
+ midend_redraw(me);
midend_set_timer(me);
return NULL;
}