summaryrefslogtreecommitdiff
path: root/kicad/delta.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-20 22:09:01 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-20 22:09:01 -0300
commit04a6cbca7bce3b240c2958b6b6cef69108bcec9b (patch)
tree470df362b648982938afe804d110631bdb9b95ec /kicad/delta.c
parent0a4d441b9d2961d9dcec79522b9a1289ed2ece63 (diff)
downloadeeshow-04a6cbca7bce3b240c2958b6b6cef69108bcec9b.tar.gz
eeshow-04a6cbca7bce3b240c2958b6b6cef69108bcec9b.tar.bz2
eeshow-04a6cbca7bce3b240c2958b6b6cef69108bcec9b.zip
eeshow/kicad/delta.c (obj_eq): also reversed wires are equal
Diffstat (limited to 'kicad/delta.c')
-rw-r--r--kicad/delta.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/kicad/delta.c b/kicad/delta.c
index e86c821..dc744ce 100644
--- a/kicad/delta.c
+++ b/kicad/delta.c
@@ -241,18 +241,25 @@ static bool obj_eq(const struct sch_obj *a, const struct sch_obj *b,
{
if (a->type != b->type)
return 0;
+
+ /* Special treatment because we support direction reversal */
+ if (a->type == sch_obj_wire) {
+ if (a->u.wire.fn != b->u.wire.fn)
+ return 0;
+ if (a->x == b->x && a->y == b->y &&
+ a->u.wire.ex == b->u.wire.ex &&
+ a->u.wire.ey == b->u.wire.ey)
+ return 1;
+ if (a->x == b->u.wire.ex && a->y == b->u.wire.ey &&
+ a->u.wire.ex == b->x && a->u.wire.ey == b->y)
+ return 1;
+ return 0;
+ }
+
if (a->x != b->x || a->y != b->y)
return 0;
+
switch (a->type) {
- case sch_obj_wire:
- if (a->u.wire.fn != b->u.wire.fn)
- return 0;
- if (a->x != b->x || a->y != b->y)
- return 0;
- if (a->u.wire.ex != b->u.wire.ex ||
- a->u.wire.ey != b->u.wire.ey)
- return 0;
- return 1;
case sch_obj_junction:
return 1;
case sch_obj_noconn: