void NodeGraphDisplay::onControlDrag(NodeControl *nc, APoint m_pos) { if(draggedNode) { APoint c_pos = m_pos; if(draggedNode != nc) { if(draggedConnector) c_pos = nc->getConnectorPoint(getOpposite(NodeConnector::getNodeConnector(draggedConnector)->ioType)); else c_pos = nc->getConnectorPoint(getOpposite(draggedNode->getDefaultConnector()->ioType)); } connections[connectionIndex]->setHangingPos(c_pos); } }
bool NodeConnector::validConnection(NCID nc_id1, NCID nc_id2) { NodeConnector *nc1 = getNC(nc_id1), *nc2 = getNC(nc_id2); return (nc1 && nc2 && //Check that they arent null !nc1->isConnected(nc_id2) && !nc2->isConnected(nc_id1) && //Check that theyre not connected nc1->ioType == getOpposite(nc2->ioType));// && //Check that one is output and one is input //nc1->getDataType() == nc2->getDataType()); //Check that they are the same data type }
void Room::removeConnection(RoomDirection direction) { if (hasConnection(direction)) { Room * opposite = this->connected[direction]; RoomDirection oppositeDirection = getOpposite(direction); if (opposite->hasConnection(oppositeDirection)) opposite->setFromOpposite(oppositeDirection, nullptr); } this->connected[direction] = nullptr; }
void Room::setRoom(RoomDirection dir, Room* r){ connected[dir] = r; r->setFromOpposite(getOpposite(dir), this); }
bool Actor::isOpposite(DIRECTION a, DIRECTION b) { return a != none && b != none && getOpposite(a) == b; }