shithub: puzzles

Download patch

ref: 3627111c5210a5b134b0e8c43b90eed07ca2e17c
parent: bef1b2c59b443a2778a01e6c167e29ee9670603a
author: Kevin Lyles <kevinlyles@gmail.com>
date: Sat May 9 15:11:02 EDT 2015

Fix the extra arrow hanging around while moving the opposite existing arrow

--- a/galaxies.c
+++ b/galaxies.c
@@ -3263,7 +3263,7 @@
         for (x = 0; x < w; x++) {
             unsigned long flags = 0;
             int ddx = 0, ddy = 0;
-            space *sp;
+            space *sp, *opp;
             int dx, dy;
 
             /*
@@ -3301,6 +3301,11 @@
              * everything goes briefly back to background colour.
              */
             sp = &SPACE(state, x*2+1, y*2+1);
+            if (sp->flags & F_TILE_ASSOC) {
+                opp = tile_opposite(state, sp);
+            } else {
+                opp = NULL;
+            }
             if (ds->colour_scratch[y*w+x] && !flashing) {
                 flags |= (ds->colour_scratch[y*w+x] == 2 ?
                           DRAW_BLACK : DRAW_WHITE);
@@ -3316,7 +3321,9 @@
              */
             if ((sp->flags & F_TILE_ASSOC) && !ds->colour_scratch[y*w+x]) {
 		if (ui->dragging && ui->srcx == x*2+1 && ui->srcy == y*2+1) {
-		    /* don't do it */
+                    /* tile is the source, don't do it */
+                } else if (ui->dragging && opp && ui->srcx == opp->x && ui->srcy == opp->y) {
+                    /* opposite tile is the source, don't do it */
 		} else if (sp->doty != y*2+1 || sp->dotx != x*2+1) {
                     flags |= DRAW_ARROW;
                     ddy = sp->doty - (y*2+1);