C4 Engine Terathon Software C4 Engine API Documentation

• World Manager

API Links
Developer Links

Node::AddConnector

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

Connector *AddConnector(const ConnectorKey& key, NodeType type, Node *node = nullptr);

Parameters
key The key value for the connector. This is an unsigned 32-bit quantity.
type The type of node to which the connector may connect. The value kTypeWildcard means that any type of node may be the connector's target.
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 type parameter specifies the type of node to which the connector is supposed to connect. This type is only a hint to the user and not prevent other types of node from being connected. However, the World Editor does enforce the node type for the connector if it is not kTypeWildcard.

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 nodes are both set to the hub attached to the node for which the AddConnector function is called.
See Also

Hub

Connector

Node::GetHub

Node::GetConnectedNode

Node::SetConnectedNode