Ticket #68: ticket68.patch

File ticket68.patch, 2.8 KB (added by Olly Betts, 8 years ago)

First attempt at a patch

  • src/extend.c

    diff --git a/src/extend.c b/src/extend.c
    index 40a68678..4e0c00e8 100644
    a b static img *pimg_out; 
    8383
    8484static int show_breaks = 0;
    8585
    86 static void do_stn(point *, double, const char *, int, int);
     86static void do_stn(point *, point *, double, const char *, int, int);
    8787
    8888typedef struct pfx {
    8989   const char *label;
    main(int argc, char **argv) 
    636636         }
    637637      }
    638638   }
     639   fprintf(stderr, "*start %s\n", start->stns->label);
    639640
    640641   /* TRANSLATORS: for extend:
    641642    * Used to tell the user that a file is being written - %s is the filename
    main(int argc, char **argv) 
    645646   pimg_out = img_open_write(fnm_out, desc, img_FFLAG_EXTENDED);
    646647
    647648   /* Only does single connected component currently. */
    648    do_stn(start, 0.0, NULL, ERIGHT, 0);
     649   do_stn(NULL, start, 0.0, NULL, ERIGHT, 0);
    649650
    650651   if (have_xsect) {
    651652      img_rewind(pimg);
    static int adjust_direction(int dir, int by) { 
    694695}
    695696
    696697static void
    697 do_stn(point *p, double X, const char *prefix, int dir, int labOnly)
     698do_stn(point * prev, point *p, double X, const char *prefix, int dir, int labOnly)
    698699{
    699700   leg *l, *lp;
    700701   double dX;
    do_stn(point *p, double X, const char *prefix, int dir, int labOnly) 
    704705   for (s = p->stns; s; s = s->next) {
    705706      img_write_item(pimg_out, img_LABEL, s->flags, s->label, X, 0, p->p.z);
    706707   }
    707    if (show_breaks && p->X != HUGE_VAL && p->X != X) {
    708       /* Draw "surface" leg between broken stations. */
    709       img_write_item(pimg_out, img_MOVE, 0, NULL, p->X, 0, p->p.z);
    710       img_write_item(pimg_out, img_LINE, img_FLAG_SURFACE, NULL, X, 0, p->p.z);
     708   if (p->X != HUGE_VAL && p->X != X) {
     709      fprintf(stderr, "*break %s %s\n", p->stns->label, prev->stns->label);
     710      if (show_breaks) {
     711         /* Draw "surface" leg between broken stations. */
     712         img_write_item(pimg_out, img_MOVE, 0, NULL, p->X, 0, p->p.z);
     713         img_write_item(pimg_out, img_LINE, img_FLAG_SURFACE, NULL, X, 0, p->p.z);
     714      }
    711715   }
    712716   p->X = X;
    713717   if (labOnly || p->fBroken) {
    do_stn(point *p, double X, const char *prefix, int dir, int labOnly) 
    743747            img_write_item(pimg_out, img_LINE, l->flags, l->prefix,
    744748                           X, 0, l->to->p.z);
    745749            l->fDone = 1;
    746             do_stn(l->fr, X + dX, l->prefix, dir, (l->broken & BREAK_FR));
     750            do_stn(p, l->fr, X + dX, l->prefix, dir, (l->broken & BREAK_FR));
    747751            l = lp;
    748752         } else if (l->fr == p) {
    749753            if (l->broken & BREAK_FR) continue;
    do_stn(point *p, double X, const char *prefix, int dir, int labOnly) 
    758762            img_write_item(pimg_out, img_LINE, l->flags, l->prefix,
    759763                           X + dX, 0, l->to->p.z);
    760764            l->fDone = 1;
    761             do_stn(l->to, X + dX, l->prefix, dir, (l->broken & BREAK_TO));
     765            do_stn(p, l->to, X + dX, l->prefix, dir, (l->broken & BREAK_TO));
    762766            l = lp;
    763767         }
    764768      }