Created
February 7, 2013 20:47
-
-
Save ChristopherS/4734022 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PyObject* pyVault::GetAllOnlinePlayers() | |
{ | |
VaultPlayerInfoNode *playerNode; | |
PyObject *playerList = PyList_New(0); | |
playerNode->SetOnline(1); | |
ARRAY(unsigned) nodeIds; | |
VaultFindNodesAndWait(playerNode, &nodeIds); //<- here is the problem | |
if (nodeIds.Count()) | |
{ | |
// Only fetch the first matching node since this function returns a single node | |
for(int i=0; i<nodeIds.Count(); i++) | |
{ | |
VaultFetchNodesAndWait(&nodeIds[i], 1); | |
playerNode = (VaultPlayerInfoNode *)VaultGetNodeIncRef(nodeIds[i]); | |
if(playerNode) | |
{ | |
plString playerName = plString::FromWchar(playerNode->GetPlayerName()); | |
PyObject *player = pyPlayer::New(playerName.c_str(), playerNode->GetPlayerId()); | |
PyList_Append(playerList, player); | |
} | |
} | |
} | |
return playerList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment