X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/819b9aaf8a357efbf4d095ef9268cbcbb46c52e9..624231601a0f5daea9b8809993ad3503beafce4f:/Dispatcher.cpp diff --git a/Dispatcher.cpp b/Dispatcher.cpp index bbbb945..10880cc 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -82,7 +82,7 @@ void Dispatcher::closeCurrentProject() { } bool Dispatcher::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2) { - + ConnectedInterface* ref1 = iface1->refInter; ConnectedInterface* ref2 = iface2->refInter; // connect both interface @@ -90,13 +90,17 @@ bool Dispatcher::createConnectionItem(InterfaceItem *iface1, InterfaceItem *ifac bool ok1 = false; bool ok2 = false; - if (ref1->canConnectTo(ref2)) { - ok1 = ref1->connectTo(ref2); - ok1 = ok1 & ref2->connectFrom(ref1); - } - if (ref2->canConnectTo(ref1)) { - ok2 = ref2->connectTo(ref1); - ok2 = ok2 & ref1->connectFrom(ref2); + // test the ref1->ref2 connection + if ((ref1->canConnectTo(ref2)) && (ref2->canConnectFrom(ref1))) { + ref1->connectTo(ref2); + ref2->connectFrom(ref1); + ok1 = true; + } + // if the frist one did not work, test ref2->ref1 + if ((ok1 == false) && (ref2->canConnectTo(ref1)) && (ref1->canConnectFrom(ref2))) { + ref2->connectTo(ref1); + ref1->connectFrom(ref2); + ok2 = true; } if ((ok1 == true) || (ok2 == true)) {