aboutsummaryrefslogtreecommitdiff
path: root/src/whirligig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-20 12:23:03 +0200
committerThomas White <taw@physics.org>2015-01-29 13:23:38 +0100
commit286e7e985d27ce657da7e8318a9b61ecc0b9878b (patch)
treef3996c533c66a2b730330211b432b6af6de82a21 /src/whirligig.c
parent4a5cbd116298a0938ed0e7e47196bbab617d7731 (diff)
Fix up broken series after out-of-order arrival of frames
Diffstat (limited to 'src/whirligig.c')
-rw-r--r--src/whirligig.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/whirligig.c b/src/whirligig.c
index 568094f6..861c2d01 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -338,7 +338,16 @@ static void try_connect(struct image *win, signed int *ser, IntegerMatrix **m,
{
/* Try to connect to the left */
if ( (pos > 0) && (win[pos-1].serial != 0) ) {
- try_join(win, ser, m, ws, pos, pos-1);
+
+ if ( try_join(win, ser, m, ws, pos, pos-1) ) {
+ /* If this one connects to the left, any frames to the
+ * right might be affected */
+ int i;
+ for ( i=pos+1; i<ws; i++ ) {
+ try_join(win, ser, m, ws, i, i-1);
+ }
+ }
+
}
/* Try to connect to the right */