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