From 85005da81fcf4b9dcc3eb4e821891f1191767afd Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 23 Oct 2014 10:51:16 +0200 Subject: whirligig: Correctly handle "dump all" situation --- src/whirligig.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/whirligig.c') diff --git a/src/whirligig.c b/src/whirligig.c index 0d72a26c..08c159a3 100644 --- a/src/whirligig.c +++ b/src/whirligig.c @@ -599,6 +599,17 @@ static void add_to_window(struct image *cur, struct window *win) } else { + pos -= sf; + if ( sf > win->join_ptr ) { + win->join_ptr = 0; + } else { + win->join_ptr -= sf; + } + + if ( sf > win->ws ) { + sf = win->ws; + } + for ( i=0; iimg[i].serial != 0 ) { free_all_crystals(&win->img[i]); @@ -614,13 +625,6 @@ static void add_to_window(struct image *cur, struct window *win) memmove(win->mat[i], win->mat[i]+sf, (win->ws-sf)*sizeof(IntegerMatrix *)); } - - pos -= sf; - if ( sf > win->join_ptr ) { - win->join_ptr = 0; - } else { - win->join_ptr -= sf; - } } for ( i=0; i