static void IAddPlayer_NodesFound(ENetError result, void* param, unsigned nodeIdCount, const unsigned nodeIds[]) { NetVaultNode* parent = static_cast<NetVaultNode*>(param); if (nodeIdCount) VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr); parent->DecRef(); }
bool pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID ) { if (HasPlayer(playerID)) return true; if (!fNode) return false; NetVaultNode * templateNode = NEWZERO(NetVaultNode); templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); VaultPlayerInfoNode access(templateNode); access.SetPlayerId(playerID); ARRAY(unsigned) nodeIds; VaultLocalFindNodes(templateNode, &nodeIds); if (!nodeIds.Count()) VaultFindNodesAndWait(templateNode, &nodeIds); if (nodeIds.Count()) VaultAddChildNodeAndWait(fNode->nodeId, nodeIds[0], VaultGetPlayerId()); templateNode->DecRef(); return nodeIds.Count() != 0; }
void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID ) { if (HasPlayer(playerID) || !fNode) return; NetVaultNode* templateNode = new NetVaultNode(); templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); VaultPlayerInfoNode access(templateNode); access.SetPlayerId(playerID); ARRAY(uint32_t) nodeIds; VaultLocalFindNodes(templateNode, &nodeIds); // So, if we know about this node, we can take it easy. If not, we lazy load it. if (nodeIds.Count()) VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr); else { fNode->IncRef(); VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode); } }