C4 Engine
C4 Engine API Documentation

Node::AddConnector

Defined in:  C4Node.h
Adds a node connection.
Prototype

Connector *AddConnector(const char *key, Node *node = nullptr);

Parameters
key The key value for the connector. This is a string up to 15 bytes in length, not counting the null terminator.
node The initial target node for the connector.
Description
The AddConnector function attaches a new Connector object to a node. The key parameter specifies a unique identifier for the connector that is normally used to assign some kind of meaning to the node that it connects to. The key value is used by the Node::GetConnectedNode function to retrieve the node that is connected through a particular connector. The key value should be unique among all connectors attached to the same node. If a node has two or more connectors with the same key, then it is undefined which connector will be returned by searches for a connector with that key.

If necessary, a hub is created for the node for which the AddConnector function is called. The new connector becomes the last outgoing edge for the node's hub. If the node parameter is not nullptr, then a hub is also created for the target node, if necessary, and the new connector becomes the last incoming edge for the target node's hub.

If the node parameter is nullptr, then the new connector's start and finish elements are both set to the hub attached to the node for which the AddConnector function is called.
See Also

Hub

Connector

Node::GetHub

Node::RemoveConnector

Node::GetConnectedNode

Node::SetConnectedNode