![]() |
||||||||
|
|
||||||||
This is the prototype of the method:
class Client : public ZCom_Control { void ZCom_cbNodeRequest_Dynamic( ZCom_ConnID _id, ZCom_ClassID _requested_class, ZCom_BitStream *_announcedata, eZCom_NodeRole _role, ZCom_NodeID _net_id ) { } // all other callback methods omitted here };
The parameters to the callback give information about the connection id from which the announcement came (typically always the same id, since there seldomly are connections to several servers at once), the class id, the role which the new node will possess (either eZCom_RoleProxy or eZCom_RoleOwner), the new node's network id and a custom bitstream that can be attached when the node is registered on the server.
void Client::ZCom_cbNodeRequest_Dynamic( ZCom_ConnID _id, ZCom_ClassID _requested_class, ZCom_BitStream *_announcedata, eZCom_NodeRole _role, ZCom_NodeID _net_id ) { if (_requested_class == Tree::getClassID()) // create tree and register it with the client, i.e. 'this' Tree* tree = new Tree(this); else if (_requested_class == Rock::getClassID()) // create rock and register it with the client, i.e. 'this' Rock* rock = new Rock(this); };
That handles the creation of requested Rocks and Trees. Whenever the server creates one of these and thinks the client should have it, this callback is called, asking the client to create the object and register it's node.
1.4.6-NO