aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-23 10:51:16 +0200
committerThomas White <taw@physics.org>2015-01-29 13:23:38 +0100
commit85005da81fcf4b9dcc3eb4e821891f1191767afd (patch)
tree633a7ea067a68f2f2b79e43355bd3766b8e7640f /src
parent7ff9c4c52c977b8dcdf307ffe60e03e9b027891c (diff)
whirligig: Correctly handle "dump all" situation
Diffstat (limited to 'src')
-rw-r--r--src/whirligig.c18
1 files changed, 11 insertions, 7 deletions
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; i<sf; i++ ) {
if ( win->img[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<sf; i++ ) {