diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index b3a90bc3..3b2cbfe1 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -2436,15 +2436,15 @@ void cyMisc::RemovePublicAge( const char * ageInstanceGuid, PyObject * cbObject/ int cyMisc::GetKILevel() { int result = pfKIMsg::kNanoKI; - + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr)); if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { VaultChronicleNode chron(rvn); - result = wcstol(chron.entryValue, nil, 0); + result = wcstol(chron.GetEntryValue(), nil, 0); rvn->DecRef(); } - + return result; } @@ -2828,7 +2828,7 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[]) if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef()) { VaultPlayerNode player(pNode); - plUUID inviteUuid(player.inviteUuid); + plUUID inviteUuid = player.GetInviteUuid(); // If we don't have an invite UUID set then make a new one if (inviteUuid.IsNull()) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp index 61721e1c..40f8944f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp @@ -189,7 +189,7 @@ plUUID pyAgeVault::GetAgeGuid( void ) RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef(); if (rvn) { VaultAgeInfoNode ageInfo(rvn); - plUUID uuid = plUUID(ageInfo.ageInstUuid); + plUUID uuid = ageInfo.GetAgeInstanceGuid(); rvn->DecRef(); return uuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp index 702d10d2..0569c314 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp @@ -94,7 +94,7 @@ const char * pyDniInfoSource::GetAgeName( void ) const VaultAgeInfoNode ageInfo(node); - fAgeName = StrDupToAnsi(ageInfo.ageInstName); + fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName()); node->DecRef(); return fAgeName; @@ -105,7 +105,7 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const if (RelVaultNode * node = VaultGetAgeInfoNodeIncRef()) { VaultAgeInfoNode ageInfo(node); - plUUID uuid = plUUID(ageInfo.ageInstUuid); + plUUID uuid = ageInfo.GetAgeInstanceGuid(); node->DecRef(); return uuid; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp index 06cb591d..af2fa346 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp @@ -127,7 +127,7 @@ void pyGameScore::CreateAgeScore(const plString& name, uint32_t type, int32_t po { if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef()) { - uint32_t ownerId = ageInfo->nodeId; + uint32_t ownerId = ageInfo->GetNodeId(); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); ageInfo->DecRef(); } else @@ -143,7 +143,7 @@ void pyGameScore::CreatePlayerScore(const plString& name, uint32_t type, int32_t { if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef()) { - uint32_t ownerId = node->nodeId; + uint32_t ownerId = node->GetNodeId(); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); node->DecRef(); } else @@ -159,7 +159,7 @@ void pyGameScore::FindAgeScores(const plString& name, pyKey& rcvr) { if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef()) { - uint32_t ownerId = ageInfo->nodeId; + uint32_t ownerId = ageInfo->GetNodeId(); pfGameScore::Find(ownerId, name, rcvr.getKey()); ageInfo->DecRef(); } else @@ -175,7 +175,7 @@ void pyGameScore::FindPlayerScores(const plString& name, pyKey& rcvr) { if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef()) { - uint32_t ownerId = node->nodeId; + uint32_t ownerId = node->GetNodeId(); pfGameScore::Find(ownerId, name, rcvr.getKey()); node->DecRef(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index c09b2a75..8f356c6d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -225,11 +225,11 @@ PyObject* pyVault::GetKIUsage(void) RelVaultNode ** end = nodeArr.Term(); for (; cur != end; ++cur) { RelVaultNode * rvn = *cur; - if (rvn->nodeType == plVault::kNodeType_Image) + if (rvn->GetNodeType() == plVault::kNodeType_Image) ++pictures; - else if (rvn->nodeType == plVault::kNodeType_TextNote) + else if (rvn->GetNodeType() == plVault::kNodeType_TextNote) ++notes; - else if (rvn->nodeType == plVault::kNodeType_MarkerGame) + else if (rvn->GetNodeType() == plVault::kNodeType_MarkerGame) ++markerGames; rvn->DecRef(); } @@ -385,7 +385,7 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName ) StrToUnicode(wDevName, deviceName, arrsize(wDevName)); // Note: This actually blocks (~Hoikas) - VaultPublishNode(node.GetNode()->nodeId, wDevName); + VaultPublishNode(node.GetNode()->GetNodeId(), wDevName); } @@ -433,10 +433,10 @@ PyObject* pyVault::GetPsnlAgeSDL() const PyObject * result = nil; NetVaultNode * templateNode = new NetVaultNode; templateNode->IncRef(); - + if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { - - templateNode->fieldFlags = 0; + + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); wchar_t str[MAX_PATH]; @@ -444,8 +444,8 @@ PyObject* pyVault::GetPsnlAgeSDL() const ageInfo.SetAgeFilename(str); if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - - templateNode->fieldFlags = 0; + + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_SDL); if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) { @@ -478,10 +478,10 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec ) NetVaultNode * templateNode = new NetVaultNode; templateNode->IncRef(); - + if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { - - templateNode->fieldFlags = 0; + + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); wchar_t str[MAX_PATH]; @@ -489,8 +489,8 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec ) ageInfo.SetAgeFilename(str); if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - - templateNode->fieldFlags = 0; + + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_SDL); if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp index e5b0c0c2..0ba97e9e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp @@ -189,7 +189,7 @@ const char * pyVaultAgeInfoNode::GetAgeFilename() const if (fNode) { char str[MAX_PATH]; VaultAgeInfoNode access(fNode); - StrToAnsi(str, access.ageFilename, arrsize(str)); + StrToAnsi(str, access.GetAgeFilename(), arrsize(str)); fAgeFilename = str; } return fAgeFilename.c_str(); @@ -204,7 +204,7 @@ const char * pyVaultAgeInfoNode::GetAgeInstanceName() const if (fNode) { char str[MAX_PATH]; VaultAgeInfoNode access(fNode); - StrToAnsi(str, access.ageInstName, arrsize(str)); + StrToAnsi(str, access.GetAgeInstanceName(), arrsize(str)); fAgeInstName = str; } return fAgeInstName.c_str(); @@ -219,7 +219,7 @@ const char * pyVaultAgeInfoNode::GetAgeUserDefinedName() const if (fNode) { char str[MAX_PATH]; VaultAgeInfoNode access(fNode); - StrToAnsi(str, access.ageUserDefinedName, arrsize(str)); + StrToAnsi(str, access.GetAgeUserDefinedName(), arrsize(str)); fAgeUserName = str; } return fAgeUserName.c_str(); @@ -234,7 +234,7 @@ plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const if (fNode) { VaultAgeInfoNode access(fNode); - return plUUID(access.ageInstUuid); + return access.GetAgeInstanceGuid(); } return kNilUuid; } @@ -249,7 +249,7 @@ const char * pyVaultAgeInfoNode::GetAgeDescription() const char str[MAX_PATH]; memset(str, 0, sizeof(str)); VaultAgeInfoNode access(fNode); - StrToAnsi(str, access.ageDescription, arrsize(str)); + StrToAnsi(str, access.GetAgeDescription(), arrsize(str)); fAgeDescription = str; } return fAgeDescription.c_str(); @@ -263,9 +263,9 @@ int32_t pyVaultAgeInfoNode::GetSequenceNumber() const { if (!fNode) return -1; - + VaultAgeInfoNode access(fNode); - return access.ageSequenceNumber; + return access.GetAgeSequenceNumber(); } void pyVaultAgeInfoNode::SetSequenceNumber( int32_t v ) @@ -276,9 +276,9 @@ int32_t pyVaultAgeInfoNode::GetAgeLanguage() const { if (!fNode) return -1; - + VaultAgeInfoNode access(fNode); - return access.ageLanguage; + return access.GetAgeLanguage(); } void pyVaultAgeInfoNode::SetAgeLanguage( int32_t v ) @@ -305,7 +305,7 @@ bool pyVaultAgeInfoNode::IsPublic() const { if (fNode) { VaultAgeInfoNode access(fNode); - return access.ageIsPublic; + return access.GetIsPublic(); } return false; } @@ -315,10 +315,10 @@ const char * pyVaultAgeInfoNode::GetDisplayName() const if (fNode) { char str[MAX_PATH]; VaultAgeInfoNode access(fNode); - if (access.ageSequenceNumber > 0) - StrPrintf(str, arrsize(str), "%S(%d) %S", access.ageUserDefinedName, access.ageSequenceNumber, access.ageInstName); + if (access.GetAgeSequenceNumber() > 0) + StrPrintf(str, arrsize(str), "%S(%d) %S", access.GetAgeUserDefinedName(), access.GetAgeSequenceNumber(), access.GetAgeInstanceName()); else - StrPrintf(str, arrsize(str), "%S %S", access.ageUserDefinedName, access.ageInstName); + StrPrintf(str, arrsize(str), "%S %S", access.GetAgeUserDefinedName(), access.GetAgeInstanceName()); fAgeDispName = str; } return fAgeDispName.c_str(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp index 0115e3f4..ab7f4013 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp @@ -109,7 +109,7 @@ bool pyVaultAgeLinkNode::GetLocked() const return false; VaultAgeLinkNode access(fNode); - return !access.unlocked; + return !access.GetUnlocked(); } void pyVaultAgeLinkNode::SetVolatile( bool v ) @@ -127,7 +127,7 @@ bool pyVaultAgeLinkNode::GetVolatile() const return false; VaultAgeLinkNode access(fNode); - return access.volat; + return access.GetVolatile(); } void pyVaultAgeLinkNode::AddSpawnPoint( pySpawnPointInfo & point ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp index ff286ca6..5ad0e689 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp @@ -97,7 +97,7 @@ const char * pyVaultChronicleNode::Chronicle_GetName( void ) free(ansiName); VaultChronicleNode chron(fNode); - ansiName = StrDupToAnsi(chron.entryName); + ansiName = StrDupToAnsi(chron.GetEntryName()); return ansiName; } @@ -123,10 +123,10 @@ const char * pyVaultChronicleNode::Chronicle_GetValue( void ) VaultChronicleNode chron(fNode); - if (!chron.entryValue) + if (!chron.GetEntryValue()) return ""; - ansiValue = StrDupToAnsi(chron.entryValue); + ansiValue = StrDupToAnsi(chron.GetEntryValue()); return ansiValue; } @@ -145,5 +145,5 @@ uint32_t pyVaultChronicleNode::Chronicle_GetType( void ) return 0; VaultChronicleNode chron(fNode); - return chron.entryType; + return chron.GetEntryType(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp index c1920f95..09f4c038 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp @@ -84,7 +84,7 @@ int pyVaultFolderNode::Folder_GetType( void ) return 0; VaultFolderNode folder(fNode); - return folder.folderType; + return folder.GetFolderType(); } void pyVaultFolderNode::Folder_SetName( std::string name ) @@ -113,11 +113,11 @@ std::string pyVaultFolderNode::Folder_GetName( void ) return ""; VaultFolderNode folder(fNode); - if (!folder.folderName) + if (!folder.GetFolderName()) return ""; std::string retVal; - char* sName = hsWStringToString(folder.folderName); + char* sName = hsWStringToString(folder.GetFolderName()); retVal = sName; delete [] sName; return retVal; @@ -129,8 +129,8 @@ std::wstring pyVaultFolderNode::Folder_GetNameW( void ) return L""; VaultFolderNode folder(fNode); - if (!folder.folderName) + if (!folder.GetFolderName()) return L""; - return folder.folderName; + return folder.GetFolderName(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp index e185db00..8e282840 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp @@ -141,9 +141,9 @@ std::string pyVaultImageNode::Image_GetTitle( void ) VaultImageNode image(fNode); std::string retVal = ""; - if (image.title) + if (image.GetImageTitle()) { - char* temp = hsWStringToString(image.title); + char* temp = hsWStringToString(image.GetImageTitle()); retVal = temp; delete [] temp; } @@ -157,7 +157,7 @@ std::wstring pyVaultImageNode::Image_GetTitleW( void ) return L""; VaultImageNode image(fNode); - return image.title ? image.title : L""; + return image.GetImageTitle() ? image.GetImageTitle() : L""; } PyObject* pyVaultImageNode::Image_GetImage( void ) @@ -170,7 +170,7 @@ PyObject* pyVaultImageNode::Image_GetImage( void ) if (access.ExtractImage(&fMipmap)) { fMipmapKey = fMipmap->GetKey(); if (!fMipmapKey) - fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); + fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap); else fMipmapKey->RefObject(); } @@ -199,7 +199,7 @@ void pyVaultImageNode::Image_SetImage(pyImage& image) fMipmapKey = image.GetKey(); if (!fMipmapKey) - fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); + fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap); else fMipmapKey->RefObject(); } @@ -243,7 +243,7 @@ void pyVaultImageNode::SetImageFromScrShot() if (cyMisc::GetPipeline()->CaptureScreen(fMipmap, false, 800, 600)) { fMipmapKey = fMipmap->GetKey(); if (!fMipmapKey) - fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); + fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap); else fMipmapKey->RefObject(); access.StuffImage(fMipmap); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index 27564ff3..7cd3cb17 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -74,7 +74,7 @@ const char * pyVaultMarkerGameNode::GetGameName () const if (fNode) { VaultMarkerGameNode access(fNode); - StrToAnsi(fGameName, access.gameName, arrsize(fGameName)); + StrToAnsi(fGameName, access.GetGameName(), arrsize(fGameName)); } return fGameName; } @@ -93,7 +93,7 @@ plUUID pyVaultMarkerGameNode::GetGameGuid() const { if (fNode) { VaultMarkerGameNode access(fNode); - return access.gameGuid; + return access.GetGameGuid(); } return kNilUuid; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index 3e4dcf9f..07312dfa 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -208,7 +208,7 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const return true; if (ours == nil || theirs == nil) return false; - if (ours->nodeId == theirs->nodeId) + if (ours->GetNodeId() == theirs->GetNodeId()) return true; return ours->Matches(theirs); } @@ -217,14 +217,14 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const uint32_t pyVaultNode::GetID( void ) { if (fNode) - return fNode->nodeId; + return fNode->GetNodeId(); return 0; } uint32_t pyVaultNode::GetType( void ) { if (fNode) - return fNode->nodeType; + return fNode->GetNodeType(); return 0; } @@ -254,14 +254,14 @@ PyObject* pyVaultNode::GetOwnerNode( void ) uint32_t pyVaultNode::GetModifyTime( void ) { if (fNode) - return fNode->modifyTime; + return fNode->GetModifyTime(); return 0; } uint32_t pyVaultNode::GetCreatorNodeID( void ) { if (fNode) - return fNode->creatorId; + return fNode->GetCreatorId(); return 0; } @@ -274,7 +274,7 @@ PyObject* pyVaultNode::GetCreatorNode( void ) templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); VaultPlayerInfoNode plrInfo(templateNode); - plrInfo.SetPlayerId(fNode->creatorId); + plrInfo.SetPlayerId(fNode->GetCreatorId()); if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) { result = pyVaultPlayerInfoNode::New(rvn); @@ -293,7 +293,7 @@ PyObject* pyVaultNode::GetCreatorNode( void ) uint32_t pyVaultNode::GetCreateTime( void ) { if (fNode) - return fNode->createTime; + return fNode->GetCreateTime(); return 0; } @@ -314,8 +314,8 @@ const char * pyVaultNode::GetCreateAgeName( void ) return fCreateAgeName; if (fNode) { - if (fNode->createAgeName) - fCreateAgeName = StrDupToAnsi(fNode->createAgeName); + if (fNode->GetCreateAgeName()) + fCreateAgeName = StrDupToAnsi(fNode->GetCreateAgeName()); else fCreateAgeName = StrDup(""); } @@ -326,7 +326,7 @@ const char * pyVaultNode::GetCreateAgeName( void ) plUUID pyVaultNode::GetCreateAgeGuid(void) const { if (fNode) { - return fNode->createAgeUuid; + return fNode->GetCreateAgeUuid(); } return kNilUuid; @@ -336,7 +336,7 @@ PyObject* pyVaultNode::GetCreateAgeCoords () { if (!fNode) PYTHON_RETURN_NONE; - return pyDniCoordinates::New(nil); + return pyDniCoordinates::New(nil); } void pyVaultNode::SetID( uint32_t v ) @@ -347,7 +347,7 @@ void pyVaultNode::SetID( uint32_t v ) void pyVaultNode::SetType( int v ) { ASSERT(fNode); - if (fNode->nodeId) { + if (fNode->GetNodeId()) { FATAL("pyVaultNode: You may not change the type of a vault node"); return; } @@ -363,7 +363,7 @@ void pyVaultNode::SetOwnerNodeID( uint32_t v ) void pyVaultNode::SetCreatorNodeID( uint32_t v ) { ASSERT(fNode); - if (fNode->nodeId) { + if (fNode->GetNodeId()) { FATAL("pyVaultNode: You may not change the type of a vault node"); return; } @@ -415,7 +415,7 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t if ( !pynode->GetID() ) { // Block here until node is created and fetched =( - ASSERT(pynode->GetNode()->nodeType); + ASSERT(pynode->GetNode()->GetNodeType()); ENetError result; RelVaultNode * newNode = VaultCreateNodeAndWaitIncRef( pynode->GetNode(), @@ -435,10 +435,10 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode); Py_INCREF(nodeRef); // The callback steals the ref, according to Eric... cb->SetNode(pynode->fNode); - - VaultAddChildNode(fNode->nodeId, - pynode->fNode->nodeId, - NetCommGetPlayer()->playerInt, + + VaultAddChildNode(fNode->GetNodeId(), + pynode->fNode->GetNodeId(), + NetCommGetPlayer()->playerInt, (FVaultAddChildNodeCallback)_AddNodeCallback, cb ); @@ -474,8 +474,8 @@ void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, uint32_t cbContext) rvn->DecRef(); } - VaultAddChildNode(fNode->nodeId, - nodeID, + VaultAddChildNode(fNode->GetNodeId(), + nodeID, NetCommGetPlayer()->playerInt, (FVaultAddChildNodeCallback)_AddNodeCallback, cb @@ -499,7 +499,7 @@ bool pyVaultNode::RemoveNode( pyVaultNode& pynode, PyObject* cbObject, uint32_t // Hack the callbacks until vault notification is in place cb->VaultOperationStarted( cbContext ); - VaultRemoveChildNode(fNode->nodeId, pynode.fNode->nodeId, nil, nil); + VaultRemoveChildNode(fNode->GetNodeId(), pynode.fNode->GetNodeId(), nil, nil); cb->SetNode(pynode.fNode); cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode.fNode); @@ -525,7 +525,7 @@ void pyVaultNode::RemoveAllNodes( void ) ARRAY(unsigned) nodeIds; fNode->GetChildNodeIds(&nodeIds, 1); for (unsigned i = 0; i < nodeIds.Count(); ++i) - VaultRemoveChildNode(fNode->nodeId, nodeIds[i], nil, nil); + VaultRemoveChildNode(fNode->GetNodeId(), nodeIds[i], nil, nil); } // Add/Save this node to vault @@ -533,7 +533,7 @@ void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext) { // If the node doesn't have an id, then use it as a template to create the node in the vault, // otherwise just ignore the save request since vault nodes are now auto-saved. - if (!fNode->nodeId && fNode->nodeType) { + if (!fNode->GetNodeId() && fNode->GetNodeType()) { ENetError result; if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { fNode->DecRef(); @@ -557,7 +557,7 @@ void pyVaultNode::SaveAll(PyObject* cbObject, uint32_t cbContext) void pyVaultNode::ForceSave() { - if (!fNode->nodeId && fNode->nodeType) { + if (!fNode->GetNodeId() && fNode->GetNodeType()) { ENetError result; if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { fNode->DecRef(); @@ -576,7 +576,7 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t if (fNode) { // If the node doesn't have an id, then use it as a template to create the node in the vault, - if (!fNode->nodeId && fNode->nodeType) { + if (!fNode->GetNodeId() && fNode->GetNodeType()) { ENetError result; if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { fNode->DecRef(); @@ -717,9 +717,9 @@ PyObject* pyVaultNode::UpcastToFolderNode() if (!fNode) PYTHON_RETURN_NONE; if ( - fNode->nodeType != plVault::kNodeType_Folder && - fNode->nodeType != plVault::kNodeType_AgeInfoList && - fNode->nodeType != plVault::kNodeType_PlayerInfoList + fNode->GetNodeType() != plVault::kNodeType_Folder && + fNode->GetNodeType() != plVault::kNodeType_AgeInfoList && + fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList ) PYTHON_RETURN_NONE; @@ -730,7 +730,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoListNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_PlayerInfoList) + if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList) PYTHON_RETURN_NONE; return pyVaultPlayerInfoListNode::New(fNode); @@ -740,7 +740,7 @@ PyObject* pyVaultNode::UpcastToImageNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_Image) + if (fNode->GetNodeType() != plVault::kNodeType_Image) PYTHON_RETURN_NONE; return pyVaultImageNode::New(fNode); @@ -750,7 +750,7 @@ PyObject* pyVaultNode::UpcastToTextNoteNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_TextNote) + if (fNode->GetNodeType() != plVault::kNodeType_TextNote) PYTHON_RETURN_NONE; return pyVaultTextNoteNode::New(fNode); @@ -760,7 +760,7 @@ PyObject* pyVaultNode::UpcastToAgeLinkNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_AgeLink) + if (fNode->GetNodeType() != plVault::kNodeType_AgeLink) PYTHON_RETURN_NONE; return pyVaultAgeLinkNode::New(fNode); @@ -770,7 +770,7 @@ PyObject* pyVaultNode::UpcastToChronicleNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_Chronicle) + if (fNode->GetNodeType() != plVault::kNodeType_Chronicle) PYTHON_RETURN_NONE; return pyVaultChronicleNode::New(fNode); @@ -780,7 +780,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_PlayerInfo) + if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfo) PYTHON_RETURN_NONE; return pyVaultPlayerInfoNode::New(fNode); @@ -790,7 +790,7 @@ PyObject* pyVaultNode::UpcastToMarkerGameNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_MarkerGame) + if (fNode->GetNodeType() != plVault::kNodeType_MarkerGame) PYTHON_RETURN_NONE; return pyVaultMarkerGameNode::New(fNode); @@ -800,7 +800,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_AgeInfo) + if (fNode->GetNodeType() != plVault::kNodeType_AgeInfo) PYTHON_RETURN_NONE; return pyVaultAgeInfoNode::New(fNode); @@ -810,7 +810,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoListNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_AgeInfoList) + if (fNode->GetNodeType() != plVault::kNodeType_AgeInfoList) PYTHON_RETURN_NONE; return pyVaultAgeInfoListNode::New(fNode); @@ -820,7 +820,7 @@ PyObject* pyVaultNode::UpcastToSDLNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_SDL) + if (fNode->GetNodeType() != plVault::kNodeType_SDL) PYTHON_RETURN_NONE; return pyVaultSDLNode::New(fNode); @@ -830,7 +830,7 @@ PyObject* pyVaultNode::UpcastToPlayerNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_VNodeMgrPlayer) + if (fNode->GetNodeType() != plVault::kNodeType_VNodeMgrPlayer) PYTHON_RETURN_NONE; return pyVaultPlayerNode::New(fNode); @@ -841,7 +841,7 @@ PyObject* pyVaultNode::UpcastToSystemNode() { if (!fNode) PYTHON_RETURN_NONE; - if (fNode->nodeType != plVault::kNodeType_System) + if (fNode->GetNodeType() != plVault::kNodeType_System) PYTHON_RETURN_NONE; return pyVaultSystemNode::New(fNode); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp index f9c9778b..a210d4c0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp @@ -99,22 +99,22 @@ PyObject* pyVaultNodeRef::GetChild( void ) unsigned pyVaultNodeRef::GetParentID () { if (!fParent) return 0; - return fParent->nodeId; + return fParent->GetNodeId(); } unsigned pyVaultNodeRef::GetChildID () { if (!fChild) return 0; - return fChild->nodeId; + return fChild->GetNodeId(); } unsigned pyVaultNodeRef::GetSaverID () { if (!fParent || !fChild) return 0; - unsigned saverId = 0; - if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) { - saverId = child->GetRefOwnerId(fParent->nodeId); + unsigned saverId = 0; + if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) { + saverId = child->GetRefOwnerId(fParent->GetNodeId()); child->DecRef(); } return saverId; @@ -124,9 +124,9 @@ PyObject * pyVaultNodeRef::GetSaver () { if (!fParent || !fChild) return 0; - RelVaultNode * saver = nil; - if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) { - if (unsigned saverId = child->GetRefOwnerId(fParent->nodeId)) { + RelVaultNode * saver = nil; + if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) { + if (unsigned saverId = child->GetRefOwnerId(fParent->GetNodeId())) { // Find the player info node representing the saver NetVaultNode * templateNode = new NetVaultNode; templateNode->IncRef(); @@ -163,6 +163,6 @@ bool pyVaultNodeRef::BeenSeen () { void pyVaultNodeRef::SetSeen (bool v) { if (!fParent || !fChild) return; - - fParent->SetSeen(fChild->nodeId, v); + + fParent->SetSeen(fChild->GetNodeId(), v); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp index 2211ff3e..b555cb22 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp @@ -114,7 +114,7 @@ bool pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID ) VaultFindNodesAndWait(templateNode, &nodeIds); if (nodeIds.Count()) - VaultAddChildNodeAndWait(fNode->nodeId, nodeIds[0], VaultGetPlayerId()); + VaultAddChildNodeAndWait(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId()); templateNode->DecRef(); return nodeIds.Count() != 0; @@ -130,9 +130,9 @@ void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID ) templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); VaultPlayerInfoNode access(templateNode); access.SetPlayerId(playerID); - + if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) { - VaultRemoveChildNode(fNode->nodeId, rvn->nodeId, nil, nil); + VaultRemoveChildNode(fNode->GetNodeId(), rvn->GetNodeId(), nil, nil); rvn->DecRef(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index 96dc537b..59b080fd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -94,7 +94,7 @@ uint32_t pyVaultPlayerInfoNode::Player_GetPlayerID( void ) return 0; VaultPlayerInfoNode playerInfo(fNode); - return playerInfo.playerId; + return playerInfo.GetPlayerId(); } void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name ) @@ -114,11 +114,11 @@ const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void ) return ""; VaultPlayerInfoNode playerInfo(fNode); - if (!playerInfo.playerName) + if (!playerInfo.GetPlayerName()) return ""; free(ansiPlayerName); - ansiPlayerName = StrDupToAnsi(playerInfo.playerName); + ansiPlayerName = StrDupToAnsi(playerInfo.GetPlayerName()); return ansiPlayerName; } @@ -129,7 +129,7 @@ void pyVaultPlayerInfoNode::Player_SetAgeInstanceName( const char * agename ) return; wchar_t * wStr = StrDupToUnicode(agename); - VaultPlayerInfoNode playerInfo(fNode); + VaultPlayerInfoNode playerInfo(fNode); playerInfo.SetAgeInstName(wStr); free(wStr); } @@ -140,11 +140,11 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void ) return ""; VaultPlayerInfoNode playerInfo(fNode); - if (!playerInfo.ageInstName) + if (!playerInfo.GetAgeInstName()) return ""; free(ansiAgeInstName); - ansiAgeInstName = StrDupToAnsi(playerInfo.ageInstName); + ansiAgeInstName = StrDupToAnsi(playerInfo.GetAgeInstName()); return ansiAgeInstName; } @@ -162,7 +162,7 @@ plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const { if (fNode) { VaultPlayerInfoNode playerInfo(fNode); - return playerInfo.ageInstUuid; + return playerInfo.GetAgeInstUuid(); } return kNilUuid; } @@ -183,7 +183,7 @@ bool pyVaultPlayerInfoNode::Player_IsOnline( void ) return false; VaultPlayerInfoNode playerInfo(fNode); - return playerInfo.online; + return playerInfo.GetOnline(); } int pyVaultPlayerInfoNode::Player_GetCCRLevel( void ) @@ -192,5 +192,5 @@ int pyVaultPlayerInfoNode::Player_GetCCRLevel( void ) return 0; VaultPlayerInfoNode playerInfo(fNode); - return playerInfo.ccrLevel; + return playerInfo.GetCCRLevel(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp index 3abc2d01..57189f3a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp @@ -266,8 +266,8 @@ std::string pyVaultPlayerNode::GetPlayerName() return ""; VaultPlayerNode player(fNode); - char ansiStr[MAX_PATH]; - StrToAnsi(ansiStr, player.playerName, arrsize(ansiStr)); + char ansiStr[MAX_PATH]; + StrToAnsi(ansiStr, player.GetPlayerName(), arrsize(ansiStr)); return ansiStr; } @@ -282,8 +282,8 @@ std::string pyVaultPlayerNode::GetAvatarShapeName() return ""; VaultPlayerNode player(fNode); - char ansiStr[MAX_PATH]; - StrToAnsi(ansiStr, player.avatarShapeName, arrsize(ansiStr)); + char ansiStr[MAX_PATH]; + StrToAnsi(ansiStr, player.GetAvatarShapeName(), arrsize(ansiStr)); return ansiStr; } @@ -298,7 +298,7 @@ bool pyVaultPlayerNode::IsDisabled() return false; VaultPlayerNode player(fNode); - return player.disabled; + return player.GetDisabled(); } void pyVaultPlayerNode::SetOnlineTime(uint32_t value) @@ -312,7 +312,7 @@ uint32_t pyVaultPlayerNode::GetOnlineTime() return 0; VaultPlayerNode player(fNode); - return player.onlineTime; + return player.GetOnlineTime(); } void pyVaultPlayerNode::SetExplorer (bool b) { @@ -328,5 +328,5 @@ bool pyVaultPlayerNode::IsExplorer () { return false; VaultPlayerNode player(fNode); - return player.explorer; + return player.GetExplorer(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp index 08efd884..37fa1e65 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp @@ -76,7 +76,7 @@ void pyVaultSDLNode::SetIdent( int v ) return; VaultSDLNode sdl(fNode); - sdl.SetSdlIdent(v); + sdl.SetSDLIdent(v); } int pyVaultSDLNode::GetIdent() const @@ -85,7 +85,7 @@ int pyVaultSDLNode::GetIdent() const return 0; VaultSDLNode sdl(fNode); - return sdl.sdlIdent; + return sdl.GetSDLIdent(); } PyObject * pyVaultSDLNode::GetStateDataRecord() const diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp index f57c66f9..aa679a3a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp @@ -101,9 +101,9 @@ std::string pyVaultTextNoteNode::Note_GetTitle( void ) char * aStr = nil; VaultTextNoteNode textNote(fNode); - if (textNote.noteTitle) { + if (textNote.GetNoteTitle()) { std::string result; - aStr = StrDupToAnsi(textNote.noteTitle); + aStr = StrDupToAnsi(textNote.GetNoteTitle()); result = aStr; free(aStr); return result; @@ -117,8 +117,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTitleW( void ) return L""; VaultTextNoteNode textNote(fNode); - if (textNote.noteTitle) - return textNote.noteTitle; + if (textNote.GetNoteTitle()) + return textNote.GetNoteTitle(); return L""; } @@ -151,9 +151,9 @@ std::string pyVaultTextNoteNode::Note_GetText( void ) char * aStr = nil; VaultTextNoteNode textNote(fNode); - if (textNote.noteText) { + if (textNote.GetNoteText()) { std::string result; - aStr = StrDupToAnsi(textNote.noteText); + aStr = StrDupToAnsi(textNote.GetNoteText()); result = aStr; free(aStr); return result; @@ -167,8 +167,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTextW( void ) return L""; VaultTextNoteNode textNote(fNode); - if (textNote.noteText) - return textNote.noteText; + if (textNote.GetNoteText()) + return textNote.GetNoteText(); return L""; } @@ -185,9 +185,9 @@ int32_t pyVaultTextNoteNode::Note_GetType( void ) { if (!fNode) return 0; - + VaultTextNoteNode textNote(fNode); - return textNote.noteType; + return textNote.GetNoteType(); } void pyVaultTextNoteNode::Note_SetSubType( int32_t type ) @@ -203,9 +203,9 @@ int32_t pyVaultTextNoteNode::Note_GetSubType( void ) { if (!fNode) return 0; - + VaultTextNoteNode textNote(fNode); - return textNote.noteSubType; + return textNote.GetNoteSubType(); } PyObject * pyVaultTextNoteNode::GetDeviceInbox() const diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp index 308e0c59..4aadebad 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp @@ -337,20 +337,20 @@ void NetGameRank::CopyFrom(const NetGameRank & fromRank) { ***/ //============================================================================ -static void DeallocNodeFields (NetVaultNode * node) { - free(node->createAgeName); - free(node->string64_1); - free(node->string64_2); - free(node->string64_3); - free(node->string64_4); - free(node->string64_5); - free(node->string64_6); - free(node->istring64_1); - free(node->istring64_2); - free(node->text_1); - free(node->text_2); - free(node->blob_1); - free(node->blob_2); +void NetVaultNode::DeallocNodeFields () { + free(createAgeName); + free(string64_1); + free(string64_2); + free(string64_3); + free(string64_4); + free(string64_5); + free(string64_6); + free(istring64_1); + free(istring64_2); + free(text_1); + free(text_2); + free(blob_1); + free(blob_2); } //============================================================================ @@ -369,70 +369,59 @@ NetVaultNode::NetVaultNode () //============================================================================ NetVaultNode::~NetVaultNode () { - DeallocNodeFields(this); + DeallocNodeFields(); } //============================================================================ unsigned NetVaultNode::Read_LCS (const uint8_t inbuffer[], unsigned bufsz, unsigned rwOpts) { - DeallocNodeFields(this); + DeallocNodeFields(); uint8_t * buffer = const_cast(inbuffer); uint8_t * start = buffer; IReadValue(&fieldFlags, &buffer, &bufsz); - - for (uint64_t bit = 1; bit; bit <<= 1) { - // if we've passed all fields on the node then bail - if (bit > fieldFlags) - break; - - // if this field isn't in the set to be read, then continue to next - if (!(bit & fieldFlags)) - continue; + #define READ(flag, func, varptr) if (flag & fieldFlags) func(varptr, &buffer, &bufsz); + #define READARR(flag, func, varptr, lenptr) if (flag & fieldFlags) func(varptr, lenptr, &buffer, &bufsz); + READ(kNodeId, IReadValue, &nodeId); + READ(kCreateTime, IReadValue, &createTime); + READ(kModifyTime, IReadValue, &modifyTime); + READ(kCreateAgeName,IReadString, &createAgeName); + READ(kCreateAgeUuid,IReadValue, &createAgeUuid); + READ(kCreatorAcct, IReadValue, &creatorAcct); + READ(kCreatorId, IReadValue, &creatorId); + READ(kNodeType, IReadValue, &nodeType); + READ(kInt32_1, IReadValue, &int32_1); + READ(kInt32_2, IReadValue, &int32_2); + READ(kInt32_3, IReadValue, &int32_3); + READ(kInt32_4, IReadValue, &int32_4); + READ(kUInt32_1, IReadValue, &uint32_1); + READ(kUInt32_2, IReadValue, &uint32_2); + READ(kUInt32_3, IReadValue, &uint32_3); + READ(kUInt32_4, IReadValue, &uint32_4); + READ(kUuid_1, IReadValue, &uuid_1); + READ(kUuid_2, IReadValue, &uuid_2); + READ(kUuid_3, IReadValue, &uuid_3); + READ(kUuid_4, IReadValue, &uuid_4); + READ(kString64_1, IReadString, &string64_1); + READ(kString64_2, IReadString, &string64_2); + READ(kString64_3, IReadString, &string64_3); + READ(kString64_4, IReadString, &string64_4); + READ(kString64_5, IReadString, &string64_5); + READ(kString64_6, IReadString, &string64_6); + READ(kIString64_1, IReadString, &istring64_1); + READ(kIString64_2, IReadString, &istring64_2); + READ(kText_1, IReadString, &text_1); + READ(kText_2, IReadString, &text_2); + READARR(kBlob_1, IReadArray, &blob_1, &blob_1Length); + READARR(kBlob_2, IReadArray, &blob_2, &blob_2Length); + #undef READARR + #undef READ + + if (fieldFlags & ~kAllValidFields) + FATAL("Invalid field flag(s) encountered"); - #define READ(flag, func, varptr) case flag: func(varptr, &buffer, &bufsz); break - #define READARR(flag, func, varptr, lenptr) case flag: func(varptr, lenptr, &buffer, &bufsz); break - switch (bit) { - READ(kNodeId, IReadValue, &nodeId); - READ(kCreateTime, IReadValue, &createTime); - READ(kModifyTime, IReadValue, &modifyTime); - READ(kCreateAgeName,IReadString, &createAgeName); - READ(kCreateAgeUuid,IReadValue, &createAgeUuid); - READ(kCreatorAcct, IReadValue, &creatorAcct); - READ(kCreatorId, IReadValue, &creatorId); - READ(kNodeType, IReadValue, &nodeType); - READ(kInt32_1, IReadValue, &int32_1); - READ(kInt32_2, IReadValue, &int32_2); - READ(kInt32_3, IReadValue, &int32_3); - READ(kInt32_4, IReadValue, &int32_4); - READ(kUInt32_1, IReadValue, &uint32_1); - READ(kUInt32_2, IReadValue, &uint32_2); - READ(kUInt32_3, IReadValue, &uint32_3); - READ(kUInt32_4, IReadValue, &uint32_4); - READ(kUuid_1, IReadValue, &uuid_1); - READ(kUuid_2, IReadValue, &uuid_2); - READ(kUuid_3, IReadValue, &uuid_3); - READ(kUuid_4, IReadValue, &uuid_4); - READ(kString64_1, IReadString, &string64_1); - READ(kString64_2, IReadString, &string64_2); - READ(kString64_3, IReadString, &string64_3); - READ(kString64_4, IReadString, &string64_4); - READ(kString64_5, IReadString, &string64_5); - READ(kString64_6, IReadString, &string64_6); - READ(kIString64_1, IReadString, &istring64_1); - READ(kIString64_2, IReadString, &istring64_2); - READ(kText_1, IReadString, &text_1); - READ(kText_2, IReadString, &text_2); - READARR(kBlob_1, IReadArray, &blob_1, &blob_1Length); - READARR(kBlob_2, IReadArray, &blob_2, &blob_2Length); - DEFAULT_FATAL(bit); - } - #undef READARR - #undef READ - } - if (rwOpts & kRwUpdateDirty) dirtyFlags = fieldFlags; else @@ -455,57 +444,46 @@ unsigned NetVaultNode::Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts) { return 0; IWriteValue(flags, buffer); - - for (uint64_t bit = 1; bit; bit <<= 1) { - // if we've passed all fields on the node then bail - if (bit > flags) - break; - - // if this field isn't in the set to be written, then continue to next - if (!(bit & flags)) - continue; - - #define WRITE(flag, func, var) case flag: func(var, buffer); break - #define WRITEARR(flag, func, var, len) case flag: func(var, len, buffer); break - switch (bit) { - WRITE(kNodeId, IWriteValue, nodeId ); - WRITE(kCreateTime, IWriteValue, createTime ); - WRITE(kModifyTime, IWriteValue, modifyTime ); - WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" ); - WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid ); - WRITE(kCreatorAcct, IWriteValue, creatorAcct ); - WRITE(kCreatorId, IWriteValue, creatorId ); - WRITE(kNodeType, IWriteValue, nodeType ); - WRITE(kInt32_1, IWriteValue, int32_1 ); - WRITE(kInt32_2, IWriteValue, int32_2 ); - WRITE(kInt32_3, IWriteValue, int32_3 ); - WRITE(kInt32_4, IWriteValue, int32_4 ); - WRITE(kUInt32_1, IWriteValue, uint32_1 ); - WRITE(kUInt32_2, IWriteValue, uint32_2 ); - WRITE(kUInt32_3, IWriteValue, uint32_3 ); - WRITE(kUInt32_4, IWriteValue, uint32_4 ); - WRITE(kUuid_1, IWriteValue, uuid_1 ); - WRITE(kUuid_2, IWriteValue, uuid_2 ); - WRITE(kUuid_3, IWriteValue, uuid_3 ); - WRITE(kUuid_4, IWriteValue, uuid_4 ); - WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" ); - WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" ); - WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" ); - WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" ); - WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" ); - WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" ); - WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" ); - WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" ); - WRITE(kText_1, IWriteString, text_1 ? text_1 : L"" ); - WRITE(kText_2, IWriteString, text_2 ? text_2 : L"" ); - WRITEARR(kBlob_1, IWriteArray, blob_1, blob_1Length); - WRITEARR(kBlob_2, IWriteArray, blob_2, blob_2Length); - DEFAULT_FATAL(bit); - } - #undef WRITEARR - #undef WRITE - } + #define WRITE(flag, func, var) if (flag & flags) func(var, buffer); + #define WRITEARR(flag, func, var, len) if (flag & flags) func(var, len, buffer); + WRITE(kNodeId, IWriteValue, nodeId ); + WRITE(kCreateTime, IWriteValue, createTime ); + WRITE(kModifyTime, IWriteValue, modifyTime ); + WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" ); + WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid ); + WRITE(kCreatorAcct, IWriteValue, creatorAcct ); + WRITE(kCreatorId, IWriteValue, creatorId ); + WRITE(kNodeType, IWriteValue, nodeType ); + WRITE(kInt32_1, IWriteValue, int32_1 ); + WRITE(kInt32_2, IWriteValue, int32_2 ); + WRITE(kInt32_3, IWriteValue, int32_3 ); + WRITE(kInt32_4, IWriteValue, int32_4 ); + WRITE(kUInt32_1, IWriteValue, uint32_1 ); + WRITE(kUInt32_2, IWriteValue, uint32_2 ); + WRITE(kUInt32_3, IWriteValue, uint32_3 ); + WRITE(kUInt32_4, IWriteValue, uint32_4 ); + WRITE(kUuid_1, IWriteValue, uuid_1 ); + WRITE(kUuid_2, IWriteValue, uuid_2 ); + WRITE(kUuid_3, IWriteValue, uuid_3 ); + WRITE(kUuid_4, IWriteValue, uuid_4 ); + WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" ); + WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" ); + WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" ); + WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" ); + WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" ); + WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" ); + WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" ); + WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" ); + WRITE(kText_1, IWriteString, text_1 ? text_1 : L"" ); + WRITE(kText_2, IWriteString, text_2 ? text_2 : L"" ); + WRITEARR(kBlob_1, IWriteArray, blob_1, blob_1Length); + WRITEARR(kBlob_2, IWriteArray, blob_2, blob_2Length); + #undef WRITEARR + #undef WRITE + + if (flags & ~kAllValidFields) + FATAL("Invalid field flag(s) encountered"); if (rwOpts & kRwUpdateDirty) dirtyFlags = 0; @@ -520,7 +498,7 @@ bool NetVaultNode::Matches (const NetVaultNode * other) { // if bit has gone past all set fields on the other node without failing, return true if (bit > other->fieldFlags) return true; - + // if the other node does not have the field, then continue to next field if (!(bit & other->fieldFlags)) continue; @@ -528,7 +506,7 @@ bool NetVaultNode::Matches (const NetVaultNode * other) { // if we don't have the field (but the other node does), then return false if (!(bit & fieldFlags)) return false; - + #define COMPARE(flag, func, var) case flag: if (!func(var, other->var)) return false; break switch (bit) { COMPARE(kNodeId, ICompareValue, nodeId); @@ -574,16 +552,16 @@ bool NetVaultNode::Matches (const NetVaultNode * other) { void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { if (this == other) return; - + uint64_t origDirtyFlags = dirtyFlags; - + for (uint64_t bit = 1; bit; bit <<= 1) { // we already have a value for this field... if (bit & fieldFlags) { if (!(copyOpts & kCopyOverwrite)) continue; // don't overwrite our field value } - + // other does not have a value for this field... if (!(bit & other->fieldFlags)) { // clear our field? @@ -591,10 +569,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { continue; // clear our field. if (bit & fieldFlags) { - #define _ZERO(flag, func, var, z) case flag: func(bit, this, &var, z); break - #define _ZEROSTRING(flag, func, var, z) case flag: func(bit, this, &var, z, kMaxVaultNodeStringLength); break - #define _ZEROCLOB(flag, func, var, z) case flag: func(bit, this, &var, z, (unsigned)-1); break - #define _ZEROARR(flag, func, var, varlen) case flag: func(bit, this, &var, &varlen, nil, 0); break + #define _ZERO(flag, func, var, z) case flag: func(bit, &var, z); break + #define _ZEROSTRING(flag, func, var, z) case flag: func(bit, &var, z, kMaxVaultNodeStringLength); break + #define _ZEROCLOB(flag, func, var, z) case flag: func(bit, &var, z, (unsigned)-1); break + #define _ZEROARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, nil, 0); break switch (bit) { _ZERO(kNodeId, IVaultNodeSetValue, nodeId, (unsigned)0); _ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0); @@ -637,10 +615,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { } } - #define COPY(flag, func, var) case flag: func(bit, this, &var, other->var); break - #define COPYSTRING(flag, func, var) case flag: func(bit, this, &var, other->var, kMaxVaultNodeStringLength); break - #define COPYCLOB(flag, func, var) case flag: func(bit, this, &var, other->var, (unsigned)-1); break - #define COPYARR(flag, func, var, varlen) case flag: func(bit, this, &var, &varlen, other->var, other->varlen); break + #define COPY(flag, func, var) case flag: func(bit, &var, other->var); break + #define COPYSTRING(flag, func, var) case flag: func(bit, &var, other->var, kMaxVaultNodeStringLength); break + #define COPYCLOB(flag, func, var) case flag: func(bit, &var, other->var, (unsigned)-1); break + #define COPYARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, other->var, other->varlen); break switch (bit) { COPY(kNodeId, IVaultNodeSetValue, nodeId ); COPY(kCreateTime, IVaultNodeSetValue, createTime ); @@ -688,408 +666,162 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { //============================================================================ void NetVaultNode::SetNodeId (unsigned v) { - IVaultNodeSetValue(kNodeId, this, &nodeId, v); + IVaultNodeSetValue(kNodeId, &nodeId, v); } //============================================================================ void NetVaultNode::SetCreateTime (unsigned v) { - IVaultNodeSetValue(kCreateTime, this, &createTime, v); + IVaultNodeSetValue(kCreateTime, &createTime, v); } //============================================================================ void NetVaultNode::SetModifyTime (unsigned v) { - IVaultNodeSetValue(kModifyTime, this, &modifyTime, v); + IVaultNodeSetValue(kModifyTime, &modifyTime, v); } //============================================================================ void NetVaultNode::SetCreateAgeName (const wchar_t v[]) { - IVaultNodeSetString(kCreateAgeName, this, &createAgeName, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kCreateAgeName, &createAgeName, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetCreateAgeUuid (const plUUID& v) { - IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v); + IVaultNodeSetValue(kCreateAgeUuid, &createAgeUuid, v); } //============================================================================ void NetVaultNode::SetCreatorAcct (const plUUID& v) { - IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, v); + IVaultNodeSetValue(kCreatorAcct, &creatorAcct, v); } //============================================================================ void NetVaultNode::SetCreatorId (unsigned v) { - IVaultNodeSetValue(kCreatorId, this, &creatorId, v); + IVaultNodeSetValue(kCreatorId, &creatorId, v); } //============================================================================ void NetVaultNode::SetNodeType (unsigned v) { - IVaultNodeSetValue(kNodeType, this, &nodeType, v); + IVaultNodeSetValue(kNodeType, &nodeType, v); } //============================================================================ void NetVaultNode::SetInt32_1 (int v) { - IVaultNodeSetValue(kInt32_1, this, &int32_1, v); + IVaultNodeSetValue(kInt32_1, &int32_1, v); } //============================================================================ void NetVaultNode::SetInt32_2 (int v) { - IVaultNodeSetValue(kInt32_2, this, &int32_2, v); + IVaultNodeSetValue(kInt32_2, &int32_2, v); } //============================================================================ void NetVaultNode::SetInt32_3 (int v) { - IVaultNodeSetValue(kInt32_3, this, &int32_3, v); + IVaultNodeSetValue(kInt32_3, &int32_3, v); } //============================================================================ void NetVaultNode::SetInt32_4 (int v) { - IVaultNodeSetValue(kInt32_4, this, &int32_4, v); + IVaultNodeSetValue(kInt32_4, &int32_4, v); } //============================================================================ void NetVaultNode::SetUInt32_1 (unsigned v) { - IVaultNodeSetValue(kUInt32_1, this, &uint32_1, v); + IVaultNodeSetValue(kUInt32_1, &uint32_1, v); } //============================================================================ void NetVaultNode::SetUInt32_2 (unsigned v) { - IVaultNodeSetValue(kUInt32_2, this, &uint32_2, v); + IVaultNodeSetValue(kUInt32_2, &uint32_2, v); } //============================================================================ void NetVaultNode::SetUInt32_3 (unsigned v) { - IVaultNodeSetValue(kUInt32_3, this, &uint32_3, v); + IVaultNodeSetValue(kUInt32_3, &uint32_3, v); } //============================================================================ void NetVaultNode::SetUInt32_4 (unsigned v) { - IVaultNodeSetValue(kUInt32_4, this, &uint32_4, v); + IVaultNodeSetValue(kUInt32_4, &uint32_4, v); } //============================================================================ void NetVaultNode::SetUuid_1 (const plUUID& v) { - IVaultNodeSetValue(kUuid_1, this, &uuid_1, v); + IVaultNodeSetValue(kUuid_1, &uuid_1, v); } //============================================================================ void NetVaultNode::SetUuid_2 (const plUUID& v) { - IVaultNodeSetValue(kUuid_2, this, &uuid_2, v); + IVaultNodeSetValue(kUuid_2, &uuid_2, v); } //============================================================================ void NetVaultNode::SetUuid_3 (const plUUID& v) { - IVaultNodeSetValue(kUuid_3, this, &uuid_3, v); + IVaultNodeSetValue(kUuid_3, &uuid_3, v); } //============================================================================ void NetVaultNode::SetUuid_4 (const plUUID& v) { - IVaultNodeSetValue(kUuid_4, this, &uuid_4, v); + IVaultNodeSetValue(kUuid_4, &uuid_4, v); } //============================================================================ void NetVaultNode::SetString64_1 (const wchar_t v[]) { - IVaultNodeSetString(kString64_1, this, &string64_1, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_1, &string64_1, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetString64_2 (const wchar_t v[]) { - IVaultNodeSetString(kString64_2, this, &string64_2, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_2, &string64_2, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetString64_3 (const wchar_t v[]) { - IVaultNodeSetString(kString64_3, this, &string64_3, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_3, &string64_3, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetString64_4 (const wchar_t v[]) { - IVaultNodeSetString(kString64_4, this, &string64_4, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_4, &string64_4, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetString64_5 (const wchar_t v[]) { - IVaultNodeSetString(kString64_5, this, &string64_5, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_5, &string64_5, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetString64_6 (const wchar_t v[]) { - IVaultNodeSetString(kString64_6, this, &string64_6, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kString64_6, &string64_6, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetIString64_1 (const wchar_t v[]) { - IVaultNodeSetString(kIString64_1, this, &istring64_1, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kIString64_1, &istring64_1, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetIString64_2 (const wchar_t v[]) { - IVaultNodeSetString(kIString64_2, this, &istring64_2, v, kMaxVaultNodeStringLength); + IVaultNodeSetString(kIString64_2, &istring64_2, v, kMaxVaultNodeStringLength); } //============================================================================ void NetVaultNode::SetText_1 (const wchar_t v[]) { - IVaultNodeSetString(kText_1, this, &text_1, v, (unsigned)-1); + IVaultNodeSetString(kText_1, &text_1, v, (unsigned)-1); } //============================================================================ void NetVaultNode::SetText_2 (const wchar_t v[]) { - IVaultNodeSetString(kText_2, this, &text_2, v, (unsigned)-1); + IVaultNodeSetString(kText_2, &text_2, v, (unsigned)-1); } //============================================================================ void NetVaultNode::SetBlob_1 (const uint8_t v[], unsigned len) { - IVaultNodeSetBlob(kBlob_1, this, &blob_1, &blob_1Length, v, len); + IVaultNodeSetBlob(kBlob_1, &blob_1, &blob_1Length, v, len); } //============================================================================ void NetVaultNode::SetBlob_2 (const uint8_t v[], unsigned len) { - IVaultNodeSetBlob(kBlob_2, this, &blob_2, &blob_2Length, v, len); -} - -//============================================================================ -void NetVaultNode::SetText (uint64_t fieldFlag, const wchar_t v[]) { - switch (fieldFlag) { - case kText_1: SetText_1(v); break; - case kText_2: SetText_2(v); break; - DEFAULT_FATAL(fieldFlag); - } -} - -//============================================================================ -void NetVaultNode::SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len) { - switch (fieldFlag) { - case kBlob_1: SetBlob_1(v, len); break; - case kBlob_2: SetBlob_2(v, len); break; - DEFAULT_FATAL(fieldFlag); - } -} - - -/***************************************************************************** -* -* NetVaultNodeFieldArray -* -***/ - -//============================================================================ -NetVaultNodeFieldArray::NetVaultNodeFieldArray (NetVaultNode * node) -: node(node) -{ - node->IncRef("FieldArray"); - fields.Add(Field(&node->nodeId, L"NodeId")); - fields.Add(Field(&node->createTime, L"CreateTime")); - fields.Add(Field(&node->modifyTime, L"ModifyTime")); - fields.Add(Field(&node->createAgeName, L"CreateAgeName")); - fields.Add(Field(&node->createAgeUuid, L"CreateAgeUuid")); - fields.Add(Field(&node->creatorAcct, L"CreatorAcctId")); - fields.Add(Field(&node->creatorId, L"CreatorId")); - fields.Add(Field(&node->nodeType, L"NodeType")); - fields.Add(Field(&node->int32_1, L"Int32_1")); - fields.Add(Field(&node->int32_2, L"Int32_2")); - fields.Add(Field(&node->int32_3, L"Int32_3")); - fields.Add(Field(&node->int32_4, L"Int32_4")); - fields.Add(Field(&node->uint32_1, L"UInt32_1")); - fields.Add(Field(&node->uint32_2, L"UInt32_2")); - fields.Add(Field(&node->uint32_3, L"UInt32_3")); - fields.Add(Field(&node->uint32_4, L"UInt32_4")); - fields.Add(Field(&node->uuid_1, L"Uuid_1")); - fields.Add(Field(&node->uuid_2, L"Uuid_2")); - fields.Add(Field(&node->uuid_3, L"Uuid_3")); - fields.Add(Field(&node->uuid_4, L"Uuid_4")); - fields.Add(Field(&node->string64_1, L"String64_1")); - fields.Add(Field(&node->string64_2, L"String64_2")); - fields.Add(Field(&node->string64_3, L"String64_3")); - fields.Add(Field(&node->string64_4, L"String64_4")); - fields.Add(Field(&node->string64_5, L"String64_5")); - fields.Add(Field(&node->string64_6, L"String64_6")); - fields.Add(Field(&node->istring64_1, L"IString64_1")); - fields.Add(Field(&node->istring64_2, L"IString64_2")); - fields.Add(Field(&node->text_1, L"Text_1")); - fields.Add(Field(&node->text_2, L"Text_2")); - fields.Add(Field(&node->blob_1, L"Blob_1")); - fields.Add(Field(&node->blob_2, L"Blob_2")); -} - -//============================================================================ -NetVaultNodeFieldArray::~NetVaultNodeFieldArray () { - fields.Clear(); - node->DecRef("FieldArray"); -} - -//============================================================================ -void * NetVaultNodeFieldArray::GetFieldAddress (uint64_t bit) { - ASSERT(bit); - - unsigned index = 0; - for (uint64_t b = bit; b > 1; b >>= 1) - ++index; - - // do not return blob fields - if (index < fields.Count() - kNumBlobFields) - return fields[index].addr; - else - return nil; -} - -//============================================================================ -const wchar_t * NetVaultNodeFieldArray::GetFieldName (uint64_t bit) { - ASSERT(bit); - - unsigned index = 0; - for (uint64_t b = bit; b > 1; b >>= 1) - ++index; - - ASSERT(index < fields.Count()); - return fields[index].name; -} - -//============================================================================ -void NetVaultNodeFieldArray::GetFieldValueString_LCS ( - uint64_t bit, - wchar_t * dst, - unsigned dstChars -) { - void * fieldAddr = GetFieldAddress(bit); - - switch (bit) { - case NetVaultNode::kNodeId: - case NetVaultNode::kCreatorId: - case NetVaultNode::kCreateTime: - case NetVaultNode::kModifyTime: - case NetVaultNode::kNodeType: - case NetVaultNode::kUInt32_1: - case NetVaultNode::kUInt32_2: - case NetVaultNode::kUInt32_3: - case NetVaultNode::kUInt32_4: - StrPrintf(dst, dstChars, L"%u", *(unsigned *)fieldAddr); - break; - - case NetVaultNode::kInt32_1: - case NetVaultNode::kInt32_2: - case NetVaultNode::kInt32_3: - case NetVaultNode::kInt32_4: - StrPrintf(dst, dstChars, L"%i", *(int *)fieldAddr); - break; - - case NetVaultNode::kCreateAgeUuid: - case NetVaultNode::kCreatorAcct: - case NetVaultNode::kUuid_1: - case NetVaultNode::kUuid_2: - case NetVaultNode::kUuid_3: - case NetVaultNode::kUuid_4: { - plString tmp = reinterpret_cast(fieldAddr)->AsString(); - - StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp.c_str()); - } - break; - - case NetVaultNode::kCreateAgeName: - case NetVaultNode::kString64_1: - case NetVaultNode::kString64_2: - case NetVaultNode::kString64_3: - case NetVaultNode::kString64_4: - case NetVaultNode::kString64_5: - case NetVaultNode::kString64_6: - case NetVaultNode::kIString64_1: - case NetVaultNode::kIString64_2: { - wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * dstChars); - IStrSqlEscape(*(wchar_t **)fieldAddr, tmp, dstChars); - StrPrintf(dst, dstChars, L"'%s'", tmp); - free(tmp); - } - break; - -// FIELD(Text_1); -// FIELD(Text_2); -// FIELD(Blob_1); -// FIELD(Blob_2); - DEFAULT_FATAL(bit); - } -} - -//============================================================================ -void NetVaultNodeFieldArray::BuildWhereClause_LCS ( - EWhereCondition condition, - wchar_t * dst, - unsigned dstChars -) { - if (!dstChars) - return; - - dst[0] = 0; - - static const wchar_t * s_conditionStrs[] = { - L" AND ", - L" OR " - }; - - unsigned fieldCount = 0; - for (uint64_t bit = 1; bit; bit <<= 1) { - if (!(bit & node->fieldFlags)) - continue; - - if (fieldCount++) - StrPack(dst, s_conditionStrs[condition], dstChars); - - wchar_t str[256]; - GetFieldValueString_LCS(bit, str, arrsize(str)); - - StrPack(dst, GetFieldName(bit), dstChars); - StrPack(dst, L"=", dstChars); - StrPack(dst, str, dstChars); - } -} - -//============================================================================ -NetVaultNodeFieldArray::ESqlType NetVaultNodeFieldArray::GetSqlType_LCS (uint64_t bit) { - switch (bit) { - case NetVaultNode::kNodeId: - case NetVaultNode::kCreatorId: - case NetVaultNode::kCreateTime: - case NetVaultNode::kModifyTime: - case NetVaultNode::kNodeType: - case NetVaultNode::kUInt32_1: - case NetVaultNode::kUInt32_2: - case NetVaultNode::kUInt32_3: - case NetVaultNode::kUInt32_4: - return kSqlUInt32; - - case NetVaultNode::kInt32_1: - case NetVaultNode::kInt32_2: - case NetVaultNode::kInt32_3: - case NetVaultNode::kInt32_4: - return kSqlInt32; - - case NetVaultNode::kCreateAgeUuid: - case NetVaultNode::kCreatorAcct: - case NetVaultNode::kUuid_1: - case NetVaultNode::kUuid_2: - case NetVaultNode::kUuid_3: - case NetVaultNode::kUuid_4: - return kSqlUuid; - - case NetVaultNode::kCreateAgeName: - case NetVaultNode::kString64_1: - case NetVaultNode::kString64_2: - case NetVaultNode::kString64_3: - case NetVaultNode::kString64_4: - case NetVaultNode::kString64_5: - case NetVaultNode::kString64_6: - case NetVaultNode::kIString64_1: - case NetVaultNode::kIString64_2: - return kSqlString; - - case NetVaultNode::kText_1: - case NetVaultNode::kText_2: - return kSqlCLob; - -// case NetVaultNode::kBlob_1: -// case NetVaultNode::kBlob_1: -// return kSqlBlob: - - default: - return kSqlInvalid; - } + IVaultNodeSetBlob(kBlob_2, &blob_2, &blob_2Length, v, len); } diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h index dd335ec1..5962d669 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h @@ -205,32 +205,35 @@ struct NetVaultNode : AtomicRef { static const uint64_t kText_2 = (uint64_t)1<<29; static const uint64_t kBlob_1 = (uint64_t)1<<30; static const uint64_t kBlob_2 = (uint64_t)1<<31; - + + static const uint64_t kAllValidFields = 0x00000000FFFFFFFFULL; + CCritSect critsect; - + + plUUID revisionId; + +private: uint64_t fieldFlags; uint64_t dirtyFlags; - - plUUID revisionId; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked - unsigned nodeId; - unsigned createTime; - unsigned modifyTime; + uint32_t nodeId; + uint32_t createTime; + uint32_t modifyTime; wchar_t * createAgeName; plUUID createAgeUuid; plUUID creatorAcct; // accountId of node creator - unsigned creatorId; // playerId of node creator - unsigned nodeType; - int int32_1; - int int32_2; - int int32_3; - int int32_4; - unsigned uint32_1; - unsigned uint32_2; - unsigned uint32_3; - unsigned uint32_4; + uint32_t creatorId; // playerId of node creator + uint32_t nodeType; + int32_t int32_1; + int32_t int32_2; + int32_t int32_3; + int32_t int32_4; + uint32_t uint32_1; + uint32_t uint32_2; + uint32_t uint32_3; + uint32_t uint32_4; plUUID uuid_1; plUUID uuid_2; plUUID uuid_3; @@ -245,40 +248,113 @@ struct NetVaultNode : AtomicRef { wchar_t * istring64_2; wchar_t * text_1; wchar_t * text_2; - uint8_t * blob_1; uint32_t blob_1Length; - uint8_t * blob_2; uint32_t blob_2Length; + uint8_t * blob_1; size_t blob_1Length; + uint8_t * blob_2; size_t blob_2Length; + + void IVaultNodeSetString ( + uint64_t bit, + char ** pdst, + const char src[], + unsigned chars + ) { + free(*pdst); + if (src && src[0]) + *pdst = StrDupLen(src, chars); + else + *pdst = StrDupLen("", chars); + fieldFlags |= bit; + dirtyFlags |= bit; + } + + void IVaultNodeSetString ( + uint64_t bit, + wchar_t ** pdst, + const wchar_t src[], + unsigned chars + ) { + free(*pdst); + if (src && src[0]) + *pdst = StrDupLen(src, chars); + else + *pdst = StrDupLen(L"", chars); + fieldFlags |= bit; + dirtyFlags |= bit; + } + template + inline void IVaultNodeSetValue ( + uint64_t bit, + T * pdst, + const T & src + ) { + *pdst = src; + fieldFlags |= bit; + dirtyFlags |= bit; + } + + void IVaultNodeSetBlob ( + uint64_t bit, + uint8_t ** pdst, + unsigned * pdstLen, + const uint8_t src[], + unsigned srcLen + ) { + free(*pdst); + if (src) { + *pdst = (uint8_t*)malloc(srcLen); + memcpy(*pdst, src, srcLen); + *pdstLen = srcLen; + } + else { + *pdst = nil; + *pdstLen = 0; + } + fieldFlags |= bit; + dirtyFlags |= bit; + } + + void DeallocNodeFields(); + +public: NetVaultNode (); ~NetVaultNode (); - // Threaded apps: Must be called with node->critsect locked - unsigned Read_LCS (const uint8_t buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read - unsigned Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts); // returns number of bytes written - + // Threaded apps: Must be called with node->critsect locked + uint32_t Read_LCS (const uint8_t buffer[], size_t bufsz, uint32_t rwOpts); // returns number of bytes read + uint32_t Write_LCS (ARRAY(uint8_t) * buffer, uint32_t rwOpts); // returns number of bytes written + bool Matches (const NetVaultNode * other); - void CopyFrom (const NetVaultNode * other, unsigned copyOpts); - - // Threaded apps: Must be called with node->critsect locked - void SetNodeId (unsigned v); - void SetCreateTime (unsigned v); - void SetModifyTime (unsigned v); + void CopyFrom (const NetVaultNode * other, uint32_t copyOpts); + + uint64_t GetFieldFlags () const { return fieldFlags; } + void ClearFieldFlags () { fieldFlags = 0; } + + uint64_t GetDirtyFlags () const { return dirtyFlags; } + void SetDirtyFlags (uint64_t flags) { dirtyFlags |= flags; } + void ClearDirtyFlags (uint64_t flags) { dirtyFlags &= ~flags; } + + // Threaded apps: Must be called with node->critsect locked + void SetNodeId (uint32_t v); + void SetNodeId_NoDirty (uint32_t v) { nodeId = v; } + void SetCreateTime (uint32_t v); + void SetModifyTime (uint32_t v); void SetCreateAgeName (const wchar_t v[]); - void SetCreateAgeUuid (const plUUID& v); - void SetCreatorAcct (const plUUID& v); - void SetCreatorId (unsigned v); - void SetNodeType (unsigned v); - void SetInt32_1 (int v); - void SetInt32_2 (int v); - void SetInt32_3 (int v); - void SetInt32_4 (int v); - void SetUInt32_1 (unsigned v); - void SetUInt32_2 (unsigned v); - void SetUInt32_3 (unsigned v); - void SetUInt32_4 (unsigned v); - void SetUuid_1 (const plUUID& v); - void SetUuid_2 (const plUUID& v); - void SetUuid_3 (const plUUID& v); - void SetUuid_4 (const plUUID& v); + void SetCreateAgeUuid (const plUUID & v); + void SetCreatorAcct (const plUUID & v); + void SetCreatorId (uint32_t v); + void SetNodeType (uint32_t v); + void SetInt32_1 (int32_t v); + void SetInt32_2 (int32_t v); + void SetInt32_3 (int32_t v); + void SetInt32_4 (int32_t v); + void SetUInt32_1 (uint32_t v); + void SetUInt32_2 (uint32_t v); + void SetUInt32_3 (uint32_t v); + void SetUInt32_4 (uint32_t v); + void SetUuid_1 (const plUUID & v); + void SetUuid_2 (const plUUID & v); + void SetUuid_3 (const plUUID & v); + void SetUuid_4 (const plUUID & v); void SetString64_1 (const wchar_t v[]); void SetString64_2 (const wchar_t v[]); void SetString64_3 (const wchar_t v[]); @@ -289,154 +365,43 @@ struct NetVaultNode : AtomicRef { void SetIString64_2 (const wchar_t v[]); void SetText_1 (const wchar_t v[]); void SetText_2 (const wchar_t v[]); - void SetBlob_1 (const uint8_t v[], unsigned len); - void SetBlob_2 (const uint8_t v[], unsigned len); - - void SetText (uint64_t fieldFlag, const wchar_t v[]); - void SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len); - - // These are only here to aid macro expansions (naming case matches field flags) - inline unsigned GetNodeId () const { return nodeId; } - inline unsigned GetCreateTime () const { return createTime; } - inline unsigned GetModifyTime () const { return modifyTime; } - inline wchar_t * GetCreateAgeName () const { return createAgeName; } - inline plUUID GetCreateAgeUuid () const { return createAgeUuid; } - inline plUUID GetCreatorAcct () const { return creatorAcct; } - inline unsigned GetCreatorId () const { return creatorId; } - inline unsigned GetNodeType () const { return nodeType; } - inline int GetInt32_1 () const { return int32_1; } - inline int GetInt32_2 () const { return int32_2; } - inline int GetInt32_3 () const { return int32_3; } - inline int GetInt32_4 () const { return int32_4; } - inline unsigned GetUInt32_1 () const { return uint32_1; } - inline unsigned GetUInt32_2 () const { return uint32_2; } - inline unsigned GetUInt32_3 () const { return uint32_3; } - inline unsigned GetUInt32_4 () const { return uint32_4; } - inline plUUID GetUuid_1 () const { return uuid_1; } - inline plUUID GetUuid_2 () const { return uuid_2; } - inline plUUID GetUuid_3 () const { return uuid_3; } - inline plUUID GetUuid_4 () const { return uuid_4; } - inline wchar_t * GetString64_1 () const { return string64_1; } - inline wchar_t * GetString64_2 () const { return string64_2; } - inline wchar_t * GetString64_3 () const { return string64_3; } - inline wchar_t * GetString64_4 () const { return string64_4; } - inline wchar_t * GetString64_5 () const { return string64_5; } - inline wchar_t * GetString64_6 () const { return string64_6; } - inline wchar_t * GetIString64_1 () const { return istring64_1; } - inline wchar_t * GetIString64_2 () const { return istring64_2; } - // no blob "getters" -}; - - -//============================================================================ -inline void IVaultNodeSetString ( - uint64_t bit, - NetVaultNode * node, - char ** pdst, - const char src[], - unsigned chars -) { - free(*pdst); - if (src && src[0]) - *pdst = StrDupLen(src, chars); - else - *pdst = StrDupLen("", chars); - node->fieldFlags |= bit; - node->dirtyFlags |= bit; -} - -//============================================================================ -inline void IVaultNodeSetString ( - uint64_t bit, - NetVaultNode * node, - wchar_t ** pdst, - const wchar_t src[], - unsigned chars -) { - free(*pdst); - if (src && src[0]) - *pdst = StrDupLen(src, chars); - else - *pdst = StrDupLen(L"", chars); - node->fieldFlags |= bit; - node->dirtyFlags |= bit; -} - -//============================================================================ -template -inline void IVaultNodeSetValue ( - uint64_t bit, - NetVaultNode * node, - T * pdst, - const T & src -) { - *pdst = src; - node->fieldFlags |= bit; - node->dirtyFlags |= bit; -} - -//============================================================================ -inline void IVaultNodeSetBlob ( - uint64_t bit, - NetVaultNode * node, - uint8_t ** pdst, - unsigned * pdstLen, - const uint8_t src[], - unsigned srcLen -) { - free(*pdst); - if (src) { - *pdst = (uint8_t*)malloc(srcLen); - memcpy(*pdst, src, srcLen); - *pdstLen = srcLen; - } - else { - *pdst = nil; - *pdstLen = 0; - } - node->fieldFlags |= bit; - node->dirtyFlags |= bit; -} - - -//============================================================================ -// NetVaultNodeFieldArray -//============================================================================ -struct NetVaultNodeFieldArray { - enum EWhereCondition { - kAnd, - kOr - }; - enum ESqlType { - kSqlInvalid, - kSqlInt32, - kSqlUInt32, - kSqlUuid, - kSqlString, - kSqlCLob, - KSqlBlob, - }; - - struct Field { - void * addr; - const wchar_t * name; - Field (void * addr, const wchar_t name[]) - : addr(addr), name(name) - { } - }; - ARRAY(Field) fields; - NetVaultNode * node; - - NetVaultNodeFieldArray (NetVaultNode * node); - ~NetVaultNodeFieldArray (); - - void * GetFieldAddress (uint64_t bit); - const wchar_t * GetFieldName (uint64_t bit); - - // client must lock node's local critical section before calling these. - void GetFieldValueString_LCS (uint64_t bit, wchar_t * dst, unsigned dstChars); - void BuildWhereClause_LCS (EWhereCondition condition, wchar_t * dst, unsigned dstChars); - ESqlType GetSqlType_LCS (uint64_t bit); + void SetBlob_1 (const uint8_t v[], size_t len); + void SetBlob_2 (const uint8_t v[], size_t len); + + uint32_t GetNodeId () const { return nodeId; } + uint32_t GetCreateTime () const { return createTime; } + uint32_t GetModifyTime () const { return modifyTime; } + const wchar_t * GetCreateAgeName () const { return createAgeName; } + plUUID GetCreateAgeUuid () const { return createAgeUuid; } + plUUID GetCreatorAcct () const { return creatorAcct; } + uint32_t GetCreatorId () const { return creatorId; } + uint32_t GetNodeType () const { return nodeType; } + int32_t GetInt32_1 () const { return int32_1; } + int32_t GetInt32_2 () const { return int32_2; } + int32_t GetInt32_3 () const { return int32_3; } + int32_t GetInt32_4 () const { return int32_4; } + uint32_t GetUInt32_1 () const { return uint32_1; } + uint32_t GetUInt32_2 () const { return uint32_2; } + uint32_t GetUInt32_3 () const { return uint32_3; } + uint32_t GetUInt32_4 () const { return uint32_4; } + plUUID GetUuid_1 () const { return uuid_1; } + plUUID GetUuid_2 () const { return uuid_2; } + plUUID GetUuid_3 () const { return uuid_3; } + plUUID GetUuid_4 () const { return uuid_4; } + const wchar_t * GetString64_1 () const { return string64_1; } + const wchar_t * GetString64_2 () const { return string64_2; } + const wchar_t * GetString64_3 () const { return string64_3; } + const wchar_t * GetString64_4 () const { return string64_4; } + const wchar_t * GetString64_5 () const { return string64_5; } + const wchar_t * GetString64_6 () const { return string64_6; } + const wchar_t * GetIString64_1 () const { return istring64_1; } + const wchar_t * GetIString64_2 () const { return istring64_2; } + const wchar_t * GetText_1 () const { return text_1; } + const wchar_t * GetText_2 () const { return text_2; } + const uint8_t * GetBlob_1 () const { return blob_1; } + size_t GetBlob_1Length () const { return blob_1Length; } + const uint8_t * GetBlob_2 () const { return blob_2; } + size_t GetBlob_2Length () const { return blob_2Length; } }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp index 339a1512..4c7cb181 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp @@ -816,9 +816,9 @@ void plClothingOutfit::ReadFromVault() for (unsigned i = 0; i < nodes.Count(); ++i) { VaultSDLNode sdl(nodes[i]); - if (sdl.sdlDataLen) { + if (sdl.GetSDLDataLength()) { hsRAMStream ram; - ram.Write(sdl.sdlDataLen, sdl.sdlData); + ram.Write(sdl.GetSDLDataLength(), sdl.GetSDLData()); ram.Rewind(); plString sdlRecName; @@ -947,33 +947,33 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs) node->DecRef(); // REF: Work } } - + // Delete any leftover nodes - { for (unsigned i = 0; i < nodes.Count(); ++i) { - VaultDeleteNode(nodes[i]->nodeId); + for (unsigned i = 0; i < nodes.Count(); ++i) { + VaultDeleteNode(nodes[i]->GetNodeId()); nodes[i]->DecRef(); // REF: Array - }} - + } + // Create actual new nodes from their templates - { for (unsigned i = 0; i < templates.Count(); ++i) { + for (unsigned i = 0; i < templates.Count(); ++i) { ENetError result; if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) { actuals.Add(actual); } templates[i]->DecRef(); // REF: Create - }} + } // Add new nodes to outfit folder - { for (unsigned i = 0; i < actuals.Count(); ++i) { - VaultAddChildNodeAndWait(rvn->nodeId, actuals[i]->nodeId, NetCommGetPlayer()->playerInt); + for (unsigned i = 0; i < actuals.Count(); ++i) { + VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt); actuals[i]->DecRef(); // REF: Create - }} + } // Cleanup morph SDRs - {for (unsigned i = 0; i < morphs.Count(); ++i) { + for (unsigned i = 0; i < morphs.Count(); ++i) { delete morphs[i]; - }} - + } + rvn->DecRef(); } @@ -1585,8 +1585,8 @@ void plClothingMgr::AddItemsToCloset(hsTArray &items) ENetError result; if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) { VaultAddChildNodeAndWait( - rvn->nodeId, - actual->nodeId, + rvn->GetNodeId(), + actual->GetNodeId(), NetCommGetPlayer()->playerInt ); actual->DecRef(); // REF: Create diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index eb928ccf..3cc50879 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -859,7 +859,7 @@ void plSceneInputInterface::ILinkOffereeToAge() else if (RelVaultNode * linkNode = VaultGetOwnedAgeLinkIncRef(&info)) { // We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one. VaultAgeLinkNode linkAcc(linkNode); - if (linkAcc.volat) { + if (linkAcc.GetVolatile()) { if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) { plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid(&guid); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index bbd107da..a4aacc75 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -795,10 +795,10 @@ void plNetLinkingMgr::IPostProcessLink( void ) RelVaultNode* info = VaultGetPlayerInfoNodeIncRef(); if (fldr && info) - if (!fldr->IsParentOf(info->nodeId, 1)) + if (!fldr->IsParentOf(info->GetNodeId(), 1)) VaultAddChildNode( - fldr->nodeId, - info->nodeId, + fldr->GetNodeId(), + info->GetNodeId(), NetCommGetPlayer()->playerInt, nil, nil @@ -822,10 +822,10 @@ void plNetLinkingMgr::IPostProcessLink( void ) RelVaultNode* info = VaultGetPlayerInfoNodeIncRef(); if (fldr && info) - if (!fldr->IsParentOf(info->nodeId, 1)) + if (!fldr->IsParentOf(info->GetNodeId(), 1)) VaultAddChildNode( - fldr->nodeId, - info->nodeId, + fldr->GetNodeId(), + info->GetNodeId(), NetCommGetPlayer()->playerInt, nil, nil @@ -981,7 +981,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) else if (RelVaultNode* linkNode = VaultGetOwnedAgeLinkIncRef(&ageInfo)) { // We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one. VaultAgeLinkNode linkAcc(linkNode); - if (linkAcc.volat) { + if (linkAcc.GetVolatile()) { if (VaultUnregisterOwnedAgeAndWait(&ageInfo)) { // Fill in fields for new age create. if (!info->HasAgeUserDefinedName()) diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index de858553..9ba18cf6 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -5620,10 +5620,10 @@ unsigned NetCliAuthVaultNodeSave ( FNetCliAuthVaultNodeSaveCallback callback, void * param ) { - ASSERTMSG(!(node->dirtyFlags & NetVaultNode::kNodeType), "Node type may not be changed"); + ASSERTMSG(!(node->GetDirtyFlags() & NetVaultNode::kNodeType), "Node type may not be changed"); // Clear dirty bits of read-only fields before we write the node to the msg buffer - node->dirtyFlags &= ~( + node->ClearDirtyFlags( NetVaultNode::kNodeId | NetVaultNode::kNodeType | NetVaultNode::kCreatorAcct | @@ -5631,15 +5631,15 @@ unsigned NetCliAuthVaultNodeSave ( NetVaultNode::kCreateTime ); - if (!node->dirtyFlags) + if (!node->GetDirtyFlags()) return 0; - if (!node->nodeId) + if (!node->GetNodeId()) return 0; // force sending of the nodeType value, since the auth needs it. // auth will clear the field before sending it on to the vault. - node->dirtyFlags |= NetVaultNode::kNodeType; + node->SetDirtyFlags(NetVaultNode::kNodeType); // We're definitely saving this node, so assign a revisionId node->revisionId = plUUID::Generate(); @@ -5648,7 +5648,7 @@ unsigned NetCliAuthVaultNodeSave ( unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty); VaultSaveNodeTrans * trans = new VaultSaveNodeTrans( - node->nodeId, + node->GetNodeId(), node->revisionId, buffer.Count(), buffer.Ptr(), diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index f53eec13..0c8088cd 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -89,7 +89,7 @@ struct DeviceInbox : CHashKeyStr { // or stored in an IRelVaultNode's parents or children table. struct RelVaultNodeLink : THashKeyVal { HASHLINK(RelVaultNodeLink) link; - RelVaultNode * node; + RelVaultNode * const node; unsigned ownerId; bool seen; @@ -338,11 +338,11 @@ static void VaultNodeAddedDownloadCallback(ENetError result, void * param) { RelVaultNodeLink* childLink = s_nodes.Find(notify->childId); if (parentLink && childLink) { - if (childLink->node->nodeType == plVault::kNodeType_TextNote) { + if (childLink->node->GetNodeType() == plVault::kNodeType_TextNote) { VaultTextNoteNode textNote(childLink->node); - if (textNote.noteType == plVault::kNoteType_Visit) + if (textNote.GetNoteType() == plVault::kNoteType_Visit) VaultProcessVisitNote(childLink->node); - else if (textNote.noteType == plVault::kNoteType_UnVisit) + else if (textNote.GetNoteType() == plVault::kNoteType_UnVisit) VaultProcessUnvisitNote(childLink->node); } @@ -382,7 +382,7 @@ static void BuildNodeTree ( if (!parentLink) { newNodeIds->Add(refs[i].parentId); parentLink = new RelVaultNodeLink(false, 0, refs[i].parentId, new RelVaultNode); - parentLink->node->nodeId = refs[i].parentId; // set directly so that the field's dirty flag isn't set + parentLink->node->SetNodeId_NoDirty(refs[i].parentId); s_nodes.Add(parentLink); } else { @@ -392,7 +392,7 @@ static void BuildNodeTree ( if (!childLink) { newNodeIds->Add(refs[i].childId); childLink = new RelVaultNodeLink(refs[i].seen, refs[i].ownerId, refs[i].childId, new RelVaultNode); - childLink->node->nodeId = refs[i].childId; // set directly so that the field's dirty flag isn't set + childLink->node->SetNodeId_NoDirty(refs[i].childId); s_nodes.Add(childLink); } else { @@ -409,23 +409,23 @@ static void BuildNodeTree ( if (!isImmediateParent) { // Add parent to child's parents table - parentLink = new RelVaultNodeLink(false, 0, parentNode->nodeId, parentNode); + parentLink = new RelVaultNodeLink(false, 0, parentNode->GetNodeId(), parentNode); childNode->state->parents.Add(parentLink); LogMsg(kLogDebug, L"Added relationship: p:%u,c:%u", refs[i].parentId, refs[i].childId); } if (!isImmediateChild) { // Add child to parent's children table - childLink = new RelVaultNodeLink(refs[i].seen, refs[i].ownerId, childNode->nodeId, childNode); + childLink = new RelVaultNodeLink(refs[i].seen, refs[i].ownerId, childNode->GetNodeId(), childNode); parentNode->state->children.Add(childLink); - if (notifyNow || childNode->nodeType != 0) { + if (notifyNow || childNode->GetNodeType() != 0) { // We made a new link, so make the callbacks for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb)) cb->cb->AddedChildNode(parentNode, childNode); } else { - INotifyAfterDownload* notify = new INotifyAfterDownload(parentNode->nodeId, childNode->nodeId); + INotifyAfterDownload* notify = new INotifyAfterDownload(parentNode->GetNodeId(), childNode->GetNodeId()); s_notifyAfterDownload.Add(notify); } } @@ -435,11 +435,11 @@ static void BuildNodeTree ( //============================================================================ static void InitFetchedNode (RelVaultNode * rvn) { - switch (rvn->nodeType) { + switch (rvn->GetNodeType()) { case plVault::kNodeType_SDL: { VaultSDLNode access(rvn); - if (!access.sdlData || !access.sdlDataLen) - access.InitStateDataRecord(access.sdlName); + if (!access.GetSDLData() || !access.GetSDLDataLength()) + access.InitStateDataRecord(access.GetSDLName()); } break; } @@ -506,21 +506,21 @@ static void FetchNodesFromRefs ( // Fetch the nodes that do not yet have a nodetype unsigned prevId = 0; - {for (unsigned i = 0; i < nodeIds.Count(); ++i) { + for (unsigned i = 0; i < nodeIds.Count(); ++i) { RelVaultNodeLink * link = s_nodes.Find(nodeIds[i]); - if (link->node->nodeType != 0) + if (link->node->GetNodeType() != 0) continue; // filter duplicates - if (link->node->nodeId == prevId) + if (link->node->GetNodeId() == prevId) continue; - prevId = link->node->nodeId; + prevId = link->node->GetNodeId(); NetCliAuthVaultNodeFetch( nodeIds[i], fetchCallback, fetchParam ); ++(*fetchCount); - }} + } } //============================================================================ @@ -559,10 +559,10 @@ static void VaultNodeFetched ( } // Add to global node table - RelVaultNodeLink * link = s_nodes.Find(node->nodeId); + RelVaultNodeLink * link = s_nodes.Find(node->GetNodeId()); if (!link) { - link = new RelVaultNodeLink(false, 0, node->nodeId, new RelVaultNode); - link->node->nodeId = node->nodeId; // set directly so that the field's dirty flag isn't set + link = new RelVaultNodeLink(false, 0, node->GetNodeId(), new RelVaultNode); + link->node->SetNodeId_NoDirty(node->GetNodeId()); s_nodes.Add(link); } link->node->CopyFrom(node, NetVaultNode::kCopyOverwrite); @@ -584,7 +584,7 @@ static void ChangedVaultNodeFetched ( VaultNodeFetched(result, param, node); - RelVaultNodeLink* savedLink = s_nodes.Find(node->nodeId); + RelVaultNodeLink* savedLink = s_nodes.Find(node->GetNodeId()); if (savedLink) { for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb)) @@ -631,7 +631,7 @@ static void VaultNodeAdded ( unsigned inboxId = 0; if (RelVaultNode * rvnInbox = VaultGetPlayerInboxFolderIncRef()) { - inboxId = rvnInbox->nodeId; + inboxId = rvnInbox->GetNodeId(); rvnInbox->DecRef(); } @@ -654,12 +654,12 @@ static void VaultNodeAdded ( unsigned i = 0; for (; i < nodeIds.Count(); ++i) { RelVaultNodeLink * link = s_nodes.Find(nodeIds[i]); - if (link->node->nodeType != 0) + if (link->node->GetNodeType() != 0) continue; // filter duplicates - if (link->node->nodeId == prevId) + if (link->node->GetNodeId() == prevId) continue; - prevId = link->node->nodeId; + prevId = link->node->GetNodeId(); VaultDownload( L"NodeAdded", nodeIds[i], @@ -681,7 +681,7 @@ static void VaultNodeAdded ( RelVaultNodeLink* parentLink = s_nodes.Find(parentId); RelVaultNodeLink* childLink = s_nodes.Find(childId); - if (childLink->node->nodeType != 0) { + if (childLink->node->GetNodeType() != 0) { for (IVaultCallback * cb = s_callbacks.Head(); cb; cb = s_callbacks.Next(cb)) cb->cb->AddedChildNode(parentLink->node, childLink->node); } @@ -736,11 +736,11 @@ static void SaveDirtyNodes () { for (RelVaultNodeLink * link = s_nodes.Head(); link; link = s_nodes.Next(link)) { if (bytesWritten >= kMaxBytesPerSaveUpdate) break; - if (link->node->dirtyFlags) { + if (link->node->GetDirtyFlags()) { // Auth server needs the name of the sdl record - if (link->node->nodeType == plVault::kNodeType_SDL) - link->node->dirtyFlags |= VaultSDLNode::kSDLName; + if (link->node->GetNodeType() == plVault::kNodeType_SDL) + link->node->SetDirtyFlags(VaultSDLNode::kSDLName); if (unsigned bytes = NetCliAuthVaultNodeSave(link->node, nil, nil)) { bytesWritten += bytes; @@ -821,7 +821,7 @@ void VaultCreateNodeTrans::VaultNodeFetched ( VaultCreateNodeTrans * trans = (VaultCreateNodeTrans *)param; if (IS_NET_SUCCESS(result)) - trans->node = s_nodes.Find(node->nodeId)->node; + trans->node = s_nodes.Find(node->GetNodeId())->node; else trans->node = nil; @@ -940,7 +940,7 @@ void VaultDownloadTrans::VaultNodeRefsFetched ( else { // root node has no child heirarchy? Make sure we still d/l the root node if necessary. RelVaultNodeLink* rootNodeLink = s_nodes.Find(trans->vaultId); - if (!rootNodeLink || rootNodeLink->node->nodeType == 0) { + if (!rootNodeLink || rootNodeLink->node->GetNodeType() == 0) { NetCliAuthVaultNodeFetch( trans->vaultId, VaultDownloadTrans::VaultNodeFetched, @@ -1105,14 +1105,14 @@ void IRelVaultNode::Unlink (RelVaultNode * other) { ASSERT(other != node); RelVaultNodeLink * link; - if (nil != (link = parents.Find(other->nodeId))) { + if (nil != (link = parents.Find(other->GetNodeId()))) { // make them non-findable in our parents table link->link.Unlink(); // remove us from other's tables. link->node->state->Unlink(node); delete link; } - if (nil != (link = children.Find(other->nodeId))) { + if (nil != (link = children.Find(other->GetNodeId()))) { // make them non-findable in our children table link->link.Unlink(); // remove us from other's tables. @@ -1139,7 +1139,7 @@ RelVaultNode::~RelVaultNode () { //============================================================================ bool RelVaultNode::IsParentOf (unsigned childId, unsigned maxDepth) { - if (nodeId == childId) + if (GetNodeId() == childId) return false; if (maxDepth == 0) return false; @@ -1154,7 +1154,7 @@ bool RelVaultNode::IsParentOf (unsigned childId, unsigned maxDepth) { //============================================================================ bool RelVaultNode::IsChildOf (unsigned parentId, unsigned maxDepth) { - if (nodeId == parentId) + if (GetNodeId() == parentId) return false; if (maxDepth == 0) return false; @@ -1171,7 +1171,7 @@ bool RelVaultNode::IsChildOf (unsigned parentId, unsigned maxDepth) { void RelVaultNode::GetRootIds (ARRAY(unsigned) * nodeIds) { RelVaultNodeLink * link = state->parents.Head(); if (!link) { - nodeIds->Add(nodeId); + nodeIds->Add(GetNodeId()); } else { for (; link; link = state->parents.Next(link)) @@ -1194,7 +1194,7 @@ void RelVaultNode::GetChildNodeIds ( return; RelVaultNodeLink * link = state->children.Head(); for (; link; link = state->children.Next(link)) { - nodeIds->Add(link->node->nodeId); + nodeIds->Add(link->node->GetNodeId()); link->node->GetChildNodeIds(nodeIds, maxDepth-1); } } @@ -1208,7 +1208,7 @@ void RelVaultNode::GetParentNodeIds ( return; RelVaultNodeLink * link = state->parents.Head(); for (; link; link = state->parents.Next(link)) { - nodeIds->Add(link->node->nodeId); + nodeIds->Add(link->node->GetNodeId()); link->node->GetParentNodeIds(nodeIds, maxDepth-1); } } @@ -1405,7 +1405,7 @@ void RelVaultNode::GetChildFolderNodesIncRef ( unsigned RelVaultNode::GetRefOwnerId (unsigned parentId) { // find our parents' link to us and return its ownerId if (RelVaultNodeLink * parentLink = state->parents.Find(parentId)) - if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(nodeId)) + if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(GetNodeId())) return childLink->ownerId; return 0; } @@ -1414,7 +1414,7 @@ unsigned RelVaultNode::GetRefOwnerId (unsigned parentId) { bool RelVaultNode::BeenSeen (unsigned parentId) const { // find our parents' link to us and return its seen flag if (RelVaultNodeLink * parentLink = state->parents.Find(parentId)) - if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(nodeId)) + if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(GetNodeId())) return childLink->seen; return true; } @@ -1423,14 +1423,87 @@ bool RelVaultNode::BeenSeen (unsigned parentId) const { void RelVaultNode::SetSeen (unsigned parentId, bool seen) { // find our parents' link to us and set its seen flag if (RelVaultNodeLink * parentLink = state->parents.Find(parentId)) - if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(nodeId)) + if (RelVaultNodeLink * childLink = parentLink->node->state->children.Find(GetNodeId())) if (childLink->seen != seen) { childLink->seen = seen; - NetCliAuthVaultSetSeen(parentId, nodeId, seen); + NetCliAuthVaultSetSeen(parentId, GetNodeId(), seen); } } //============================================================================ +template +static bool IStrSqlEscape (const T src[], T * dst, unsigned dstChars) { + // count the number of ' chars + unsigned ticks = 0; + { + const T * cur = src; + while (*cur) { + if (*cur == L'\'') + ++ticks; + cur++; + } + } + + unsigned reqChars = StrLen(src) + ticks + 1; + + if (dstChars < reqChars) + // failure! + return false; + + T * cur = dst; + + // copy src to dst, escaping ' chars + while (*src) { + if (*src == L'\'') { + *cur++ = L'\''; + *cur++ = *src++; + continue; + } + *cur++ = *src++; + } + + // null-terminate dst string + *cur = 0; + + // success! + return true; +} + +static void IGetStringFieldValue ( + const wchar_t * value, + wchar_t * dst, + size_t dstChars +) { + wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * dstChars); + IStrSqlEscape(value, tmp, dstChars); + StrPrintf(dst, dstChars, L"'%s'", tmp); + free(tmp); +} + +static void IGetUuidFieldValue ( + const plUUID & value, + wchar_t * dst, + size_t dstChars +) { + StrPrintf(dst, dstChars, L"hextoraw('%s')", value.AsString().c_str()); +} + +static void IGetUintFieldValue ( + uint32_t value, + wchar_t * dst, + size_t dstChars +) { + StrPrintf(dst, dstChars, L"%u", value); +} + +static void IGetIntFieldValue ( + int32_t value, + wchar_t * dst, + size_t dstChars +) { + StrPrintf(dst, dstChars, L"%d", value); +} + void RelVaultNode::Print (const wchar_t tag[], FStateDump dumpProc, unsigned level) { wchar_t str[1024]; StrPrintf( @@ -1442,26 +1515,62 @@ void RelVaultNode::Print (const wchar_t tag[], FStateDump dumpProc, unsigned lev " ", level * 2, " ", - nodeId, - plVault::NodeTypeStr(nodeType, false) + GetNodeId(), + plVault::NodeTypeStr(GetNodeType(), false) ); - NetVaultNodeFieldArray fields(this); for (uint64_t bit = 1; bit; bit <<= 1) { - if (!(fieldFlags & bit)) + if (!(GetFieldFlags() & bit)) continue; - if (bit > fieldFlags) + if (bit > GetFieldFlags()) break; - - StrPack(str, L", ", arrsize(str)); - StrPack(str, fields.GetFieldName(bit), arrsize(str)); - if (fields.GetFieldAddress(bit)) { - StrPack(str, L"=", arrsize(str)); - const unsigned chars = StrLen(str); - fields.GetFieldValueString_LCS(bit, str + chars, arrsize(str) - chars * sizeof(str[0])); + + #define STPRINT(flag, func) case k##flag: { \ + StrPack(str, L", " L ## #flag L"=", arrsize(str)); \ + const size_t chars = StrLen(str); \ + func(Get##flag(), str + chars, arrsize(str) - chars * sizeof(str[0])); \ + }; break + #define STNAME(flag) case k##flag: { \ + StrPack(str, L", " L ## #flag, arrsize(str)); \ + }; break + switch (bit) { + STPRINT(NodeId, IGetUintFieldValue); + STPRINT(CreateTime, IGetUintFieldValue); + STPRINT(ModifyTime, IGetUintFieldValue); + STPRINT(CreateAgeName, IGetStringFieldValue); + STPRINT(CreateAgeUuid, IGetUuidFieldValue); + STPRINT(CreatorAcct, IGetUuidFieldValue); + STPRINT(CreatorId, IGetUintFieldValue); + STPRINT(NodeType, IGetUintFieldValue); + STPRINT(Int32_1, IGetIntFieldValue); + STPRINT(Int32_2, IGetIntFieldValue); + STPRINT(Int32_3, IGetIntFieldValue); + STPRINT(Int32_4, IGetIntFieldValue); + STPRINT(UInt32_1, IGetUintFieldValue); + STPRINT(UInt32_2, IGetUintFieldValue); + STPRINT(UInt32_3, IGetUintFieldValue); + STPRINT(UInt32_4, IGetUintFieldValue); + STPRINT(Uuid_1, IGetUuidFieldValue); + STPRINT(Uuid_2, IGetUuidFieldValue); + STPRINT(Uuid_3, IGetUuidFieldValue); + STPRINT(Uuid_4, IGetUuidFieldValue); + STPRINT(String64_1, IGetStringFieldValue); + STPRINT(String64_2, IGetStringFieldValue); + STPRINT(String64_3, IGetStringFieldValue); + STPRINT(String64_4, IGetStringFieldValue); + STPRINT(String64_5, IGetStringFieldValue); + STPRINT(String64_6, IGetStringFieldValue); + STPRINT(IString64_1, IGetStringFieldValue); + STPRINT(IString64_2, IGetStringFieldValue); + STNAME(Text_1); + STNAME(Text_2); + STNAME(Blob_1); + STNAME(Blob_2); + DEFAULT_FATAL(bit); } + #undef STPRINT } - + dumpProc(nil, str); } @@ -1476,10 +1585,10 @@ void RelVaultNode::PrintTree (FStateDump dumpProc, unsigned level) { RelVaultNode * RelVaultNode::GetParentAgeLinkIncRef () { // this function only makes sense when called on age info nodes - ASSERT(nodeType == plVault::kNodeType_AgeInfo); - + ASSERT(GetNodeType() == plVault::kNodeType_AgeInfo); + RelVaultNode * result = nil; - + NetVaultNode * templateNode = new NetVaultNode; templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_AgeLink); @@ -1645,7 +1754,7 @@ void VaultAddChildNode ( RelVaultNodeLink * childLink = s_nodes.Find(childId); if (!childLink) { childLink = new RelVaultNodeLink(false, ownerId, childId, new RelVaultNode); - childLink->node->nodeId = childId; // set directly so that the field's dirty flag isn't set + childLink->node->SetNodeId_NoDirty(childId); s_nodes.Add(childLink); } else if (ownerId) { @@ -1680,10 +1789,10 @@ void VaultAddChildNode ( BuildNodeTree(refs, arrsize(refs), &newNodeIds, &existingNodeIds); - if (!childLink->node->nodeType || !parentLink->node->nodeType) { + if (!childLink->node->GetNodeType() || !parentLink->node->GetNodeType()) { // One or more nodes need to be fetched before the callback is made AddChildNodeFetchTrans * trans = new AddChildNodeFetchTrans(callback, param); - if (!childLink->node->nodeType) { + if (!childLink->node->GetNodeType()) { AtomicAdd(&trans->opCount, 1); NetCliAuthVaultNodeFetch( childId, @@ -1697,7 +1806,7 @@ void VaultAddChildNode ( trans ); } - if (!parentLink->node->nodeType) { + if (!parentLink->node->GetNodeType()) { AtomicAdd(&trans->opCount, 1); NetCliAuthVaultNodeFetch( parentId, @@ -1861,7 +1970,7 @@ void VaultPublishNode ( } } - VaultAddChildNode(rvn->nodeId, nodeId, VaultGetPlayerId(), nil, nil); + VaultAddChildNode(rvn->GetNodeId(), nodeId, VaultGetPlayerId(), nil, nil); rvn->DecRef(); } @@ -1871,7 +1980,7 @@ void VaultSendNode ( unsigned dstPlayerId ) { NetCliAuthVaultNodeSave(srcNode, nil, nil); - NetCliAuthVaultSendNode(srcNode->nodeId, dstPlayerId); + NetCliAuthVaultSendNode(srcNode->GetNodeId(), dstPlayerId); } //============================================================================ @@ -1885,10 +1994,10 @@ void VaultCreateNode ( if (RelVaultNode * age = VaultGetAgeNodeIncRef()) { VaultAgeNode access(age); - if (!(templateNode->fieldFlags & NetVaultNode::kCreateAgeName)) - templateNode->SetCreateAgeName(access.ageName); - if (!(templateNode->fieldFlags & NetVaultNode::kCreateAgeUuid)) - templateNode->SetCreateAgeUuid(access.ageInstUuid); + if (!(templateNode->GetFieldFlags() & NetVaultNode::kCreateAgeName)) + templateNode->SetCreateAgeName(access.GetAgeName()); + if (!(templateNode->GetFieldFlags() & NetVaultNode::kCreateAgeUuid)) + templateNode->SetCreateAgeUuid(access.GetAgeInstanceGuid()); age->DecRef(); } @@ -2093,7 +2202,7 @@ void VaultLocalFindNodes ( ) { for (RelVaultNodeLink * link = s_nodes.Head(); link != nil; link = s_nodes.Next(link)) { if (link->node->Matches(templateNode)) - nodeIds->Add(link->node->nodeId); + nodeIds->Add(link->node->GetNodeId()); } } @@ -2198,7 +2307,7 @@ static RelVaultNode * GetPlayerNode () { //============================================================================ unsigned VaultGetPlayerId () { if (RelVaultNode * rvn = GetPlayerNode()) - return rvn->nodeId; + return rvn->GetNodeId(); return 0; } @@ -2221,7 +2330,7 @@ RelVaultNode * VaultGetPlayerInfoNodeIncRef () { templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); VaultPlayerInfoNode plrInfo(templateNode); - plrInfo.SetPlayerId(rvnPlr->nodeId); + plrInfo.SetPlayerId(rvnPlr->GetNodeId()); rvnPlr->DecRef(); @@ -2375,12 +2484,12 @@ RelVaultNode * VaultGetOwnedAgeLinkIncRef (const plAgeInfoStruct * info) { ageInfo.SetAgeFilename(str); } if (info->HasAgeInstanceGuid()) { - ageInfo.SetAgeInstGuid(*info->GetAgeInstanceGuid()); + ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid()); } if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - templateNode->fieldFlags = 0; - templateNode->SetNodeType(plVault::kNodeType_AgeLink); + templateNode->ClearFieldFlags(); + templateNode->SetNodeType(plVault::kNodeType_AgeLink); rvnLink = rvnInfo->GetParentNodeIncRef(templateNode, 1); rvnInfo->DecRef(); } @@ -2410,7 +2519,7 @@ RelVaultNode * VaultGetOwnedAgeInfoIncRef (const plAgeInfoStruct * info) { ageInfo.SetAgeFilename(str); } if (info->HasAgeInstanceGuid()) { - ageInfo.SetAgeInstGuid(*info->GetAgeInstanceGuid()); + ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid()); } rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2); @@ -2468,7 +2577,7 @@ bool VaultAddOwnedAgeSpawnPoint (const plUUID& ageInstId, const plSpawnPointInfo templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode access(templateNode); - access.SetAgeInstGuid(ageInstId); + access.SetAgeInstanceGuid(ageInstId); for (unsigned i = 0; i < nodeIds.Count(); ++i) { link = VaultGetNodeIncRef(nodeIds[i]); @@ -2500,11 +2609,11 @@ bool VaultAddOwnedAgeSpawnPoint (const plUUID& ageInstId, const plSpawnPointInfo bool VaultSetOwnedAgePublicAndWait (const plAgeInfoStruct * info, bool publicOrNot) { if (RelVaultNode * rvnLink = VaultGetOwnedAgeLinkIncRef(info)) { if (RelVaultNode * rvnInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { - NetCliAuthSetAgePublic(rvnInfo->nodeId, publicOrNot); + NetCliAuthSetAgePublic(rvnInfo->GetNodeId(), publicOrNot); VaultAgeInfoNode access(rvnInfo); char ageName[MAX_PATH]; - StrToAnsi(ageName, access.ageFilename, arrsize(ageName)); + StrToAnsi(ageName, access.GetAgeFilename(), arrsize(ageName)); plVaultNotifyMsg * msg = new plVaultNotifyMsg; if (publicOrNot) @@ -2539,11 +2648,11 @@ RelVaultNode * VaultGetVisitAgeLinkIncRef (const plAgeInfoStruct * info) { ageInfo.SetAgeFilename(str); } if (info->HasAgeInstanceGuid()) { - ageInfo.SetAgeInstGuid(*info->GetAgeInstanceGuid()); + ageInfo.SetAgeInstanceGuid(*info->GetAgeInstanceGuid()); } if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - templateNode->fieldFlags = 0; + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeLink); rvnLink = rvnInfo->GetParentNodeIncRef(templateNode, 1); rvnInfo->DecRef(); @@ -2614,7 +2723,7 @@ static void _CreateNodeCallback ( ) { _CreateNodeParam * param = (_CreateNodeParam *)vparam; if (IS_NET_SUCCESS(result)) - param->nodeId = node->nodeId; + param->nodeId = node->GetNodeId(); param->result = result; param->complete = true; } @@ -2645,7 +2754,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { for (;;) { if (RelVaultNode * rvn = VaultGetAgesIOwnFolderIncRef()) { - agesIOwnId = rvn->nodeId; + agesIOwnId = rvn->GetNodeId(); rvn->DecRef(); } else { @@ -2750,7 +2859,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { unsigned ageOwnersId = 0; if (RelVaultNode * rvnAgeInfo = VaultGetNodeIncRef(ageInfoId)) { if (RelVaultNode * rvnAgeOwners = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kAgeOwnersFolder, 1)) { - ageOwnersId = rvnAgeOwners->nodeId; + ageOwnersId = rvnAgeOwners->GetNodeId(); rvnAgeOwners->DecRef(); } rvnAgeInfo->DecRef(); @@ -2758,7 +2867,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { unsigned playerInfoId = 0; if (RelVaultNode * rvnPlayerInfo = VaultGetPlayerInfoNodeIncRef()) { - playerInfoId = rvnPlayerInfo->nodeId; + playerInfoId = rvnPlayerInfo->GetNodeId(); rvnPlayerInfo->DecRef(); } @@ -2869,13 +2978,13 @@ namespace _VaultRegisterOwnedAge { // Make some refs RelVaultNode* agesIOwn = VaultGetAgesIOwnFolderIncRef(); RelVaultNode* plyrInfo = VaultGetPlayerInfoNodeIncRef(); - VaultAddChildNode(agesIOwn->nodeId, node->nodeId, 0, (FVaultAddChildNodeCallback)_AddAgeLinkNode, nil); - VaultAddChildNode(node->nodeId, (uint32_t)((uintptr_t)p->fAgeInfoId), 0, (FVaultAddChildNodeCallback)_AddAgeInfoNode, nil); + VaultAddChildNode(agesIOwn->GetNodeId(), node->GetNodeId(), 0, (FVaultAddChildNodeCallback)_AddAgeLinkNode, nil); + VaultAddChildNode(node->GetNodeId(), (uint32_t)((uintptr_t)p->fAgeInfoId), 0, (FVaultAddChildNodeCallback)_AddAgeInfoNode, nil); // Add our PlayerInfo to important places if (RelVaultNode* rvnAgeInfo = VaultGetNodeIncRef((uint32_t)((uintptr_t)p->fAgeInfoId))) { if (RelVaultNode* rvnAgeOwners = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kAgeOwnersFolder, 1)) { - VaultAddChildNode(rvnAgeOwners->nodeId, plyrInfo->nodeId, 0, (FVaultAddChildNodeCallback)_AddPlayerInfoNode, nil); + VaultAddChildNode(rvnAgeOwners->GetNodeId(), plyrInfo->GetNodeId(), 0, (FVaultAddChildNodeCallback)_AddPlayerInfoNode, nil); rvnAgeOwners->DecRef(); } @@ -2886,7 +2995,7 @@ namespace _VaultRegisterOwnedAge { plVaultNotifyMsg* msg = new plVaultNotifyMsg; msg->SetType(plVaultNotifyMsg::kRegisteredOwnedAge); msg->SetResultCode(result); - msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->nodeId); + msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->GetNodeId()); msg->Send(); // Don't leak memory @@ -2988,7 +3097,7 @@ static void _CreateNodeCallback ( ) { _CreateNodeParam * param = (_CreateNodeParam *)vparam; if (IS_NET_SUCCESS(result)) - param->nodeId = node->nodeId; + param->nodeId = node->GetNodeId(); param->result = result; param->complete = true; } @@ -3018,7 +3127,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { bool result = false; for (;;) { if (RelVaultNode * rvn = VaultGetAgesICanVisitFolderIncRef()) { - agesICanVisitId = rvn->nodeId; + agesICanVisitId = rvn->GetNodeId(); rvn->DecRef(); } else { @@ -3123,7 +3232,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { unsigned ageVisitorsId = 0; if (RelVaultNode * rvnAgeInfo = VaultGetNodeIncRef(ageInfoId)) { if (RelVaultNode * rvnAgeVisitors = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kCanVisitFolder, 1)) { - ageVisitorsId = rvnAgeVisitors->nodeId; + ageVisitorsId = rvnAgeVisitors->GetNodeId(); rvnAgeVisitors->DecRef(); } rvnAgeInfo->DecRef(); @@ -3131,7 +3240,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { unsigned playerInfoId = 0; if (RelVaultNode * rvnPlayerInfo = VaultGetPlayerInfoNodeIncRef()) { - playerInfoId = rvnPlayerInfo->nodeId; + playerInfoId = rvnPlayerInfo->GetNodeId(); rvnPlayerInfo->DecRef(); } @@ -3224,7 +3333,7 @@ namespace _VaultRegisterVisitAge { // Add ourselves to the Can Visit folder of the age if (RelVaultNode * playerInfo = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode* canVisit = ageInfo->GetChildPlayerInfoListNodeIncRef(plVault::kCanVisitFolder, 1)) { - VaultAddChildNode(canVisit->nodeId, playerInfo->nodeId, 0, nil, nil); + VaultAddChildNode(canVisit->GetNodeId(), playerInfo->GetNodeId(), 0, nil, nil); canVisit->DecRef(); } @@ -3233,8 +3342,8 @@ namespace _VaultRegisterVisitAge { // Get our AgesICanVisit folder if (RelVaultNode* iCanVisit = VaultGetAgesICanVisitFolderIncRef()) { - VaultAddChildNode(node->nodeId, ageInfo->nodeId, 0, nil, nil); - VaultAddChildNode(iCanVisit->nodeId, node->nodeId, 0, nil, nil); + VaultAddChildNode(node->GetNodeId(), ageInfo->GetNodeId(), 0, nil, nil); + VaultAddChildNode(iCanVisit->GetNodeId(), node->GetNodeId(), 0, nil, nil); } // Update the AgeLink with a spawn point @@ -3245,7 +3354,7 @@ namespace _VaultRegisterVisitAge { plVaultNotifyMsg * msg = new plVaultNotifyMsg; msg->SetType(plVaultNotifyMsg::kRegisteredVisitAge); msg->SetResultCode(true); - msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->nodeId); + msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->GetNodeId()); msg->Send(); //Don't leak memory @@ -3321,31 +3430,31 @@ bool VaultUnregisterOwnedAgeAndWait (const plAgeInfoStruct * info) { } if (RelVaultNode * rvn = VaultGetAgesIOwnFolderIncRef()) { - agesIOwnId = rvn->nodeId; + agesIOwnId = rvn->GetNodeId(); rvn->DecRef(); } else { LogMsg(kLogError, L"UnregisterOwnedAge: Failed to get player's AgesIOwnFolder"); break; // something's wrong with the player vault, it doesn't have a required folder node } - - ageLinkId = rvnLink->nodeId; - + + ageLinkId = rvnLink->GetNodeId(); + unsigned ageOwnersId = 0; if (RelVaultNode * rvnAgeInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { if (RelVaultNode * rvnAgeOwners = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kAgeOwnersFolder, 1)) { - ageOwnersId = rvnAgeOwners->nodeId; + ageOwnersId = rvnAgeOwners->GetNodeId(); rvnAgeOwners->DecRef(); } rvnAgeInfo->DecRef(); } - + unsigned playerInfoId = 0; if (RelVaultNode * rvnPlayerInfo = VaultGetPlayerInfoNodeIncRef()) { - playerInfoId = rvnPlayerInfo->nodeId; + playerInfoId = rvnPlayerInfo->GetNodeId(); rvnPlayerInfo->DecRef(); } - + rvnLink->DecRef(); // remove our playerInfo from the ageOwners folder @@ -3385,20 +3494,20 @@ bool VaultUnregisterVisitAgeAndWait (const plAgeInfoStruct * info) { } if (RelVaultNode * rvn = VaultGetAgesICanVisitFolderIncRef()) { - agesICanVisitId = rvn->nodeId; + agesICanVisitId = rvn->GetNodeId(); rvn->DecRef(); } else { LogMsg(kLogError, L"UnregisterOwnedAge: Failed to get player's AgesICanVisitFolder"); break; // something's wrong with the player vault, it doesn't have a required folder node } - - ageLinkId = rvnLink->nodeId; + + ageLinkId = rvnLink->GetNodeId(); unsigned ageVisitorsId = 0; if (RelVaultNode * rvnAgeInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { if (RelVaultNode * rvnAgeVisitors = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kCanVisitFolder, 1)) { - ageVisitorsId = rvnAgeVisitors->nodeId; + ageVisitorsId = rvnAgeVisitors->GetNodeId(); rvnAgeVisitors->DecRef(); } rvnAgeInfo->DecRef(); @@ -3406,7 +3515,7 @@ bool VaultUnregisterVisitAgeAndWait (const plAgeInfoStruct * info) { unsigned playerInfoId = 0; if (RelVaultNode * rvnPlayerInfo = VaultGetPlayerInfoNodeIncRef()) { - playerInfoId = rvnPlayerInfo->nodeId; + playerInfoId = rvnPlayerInfo->GetNodeId(); rvnPlayerInfo->DecRef(); } @@ -3482,7 +3591,7 @@ void VaultAddChronicleEntryAndWait ( chrnNode.SetEntryValue(entryValue); ENetError result; if (RelVaultNode * rvnChrn = VaultCreateNodeAndWaitIncRef(templateNode, &result)) { - VaultAddChildNode(rvnFldr->nodeId, rvnChrn->nodeId, 0, nil, nil); + VaultAddChildNode(rvnFldr->GetNodeId(), rvnChrn->GetNodeId(), 0, nil, nil); rvnChrn->DecRef(); } templateNode->DecRef(); @@ -3524,7 +3633,7 @@ bool VaultGetCCRStatus () { bool retval = false; if (RelVaultNode * rvnSystem = VaultGetSystemNodeIncRef()) { VaultSystemNode sysNode(rvnSystem); - retval = (sysNode.ccrStatus != 0); + retval = (sysNode.GetCCRStatus() != 0); rvnSystem->DecRef(); } @@ -3575,7 +3684,7 @@ bool VaultAmInMyPersonalAge () { if (RelVaultNode* currentAgeInfoNode = VaultGetAgeInfoNodeIncRef()) { VaultAgeInfoNode curAgeInfo(currentAgeInfoNode); - if (ageInfo.ageInstUuid == curAgeInfo.ageInstUuid) + if (ageInfo.GetAgeInstanceGuid() == curAgeInfo.GetAgeInstanceGuid()) result = true; currentAgeInfoNode->DecRef(); @@ -3604,7 +3713,7 @@ bool VaultAmInMyNeighborhoodAge () { if (RelVaultNode* currentAgeInfoNode = VaultGetAgeInfoNodeIncRef()) { VaultAgeInfoNode curAgeInfo(currentAgeInfoNode); - if (ageInfo.ageInstUuid == curAgeInfo.ageInstUuid) + if (ageInfo.GetAgeInstanceGuid() == curAgeInfo.GetAgeInstanceGuid()) result = true; currentAgeInfoNode->DecRef(); @@ -3626,19 +3735,19 @@ bool VaultAmOwnerOfCurrentAge () { if (RelVaultNode* currentAgeInfoNode = VaultGetAgeInfoNodeIncRef()) { VaultAgeInfoNode curAgeInfo(currentAgeInfoNode); - char* ageFilename = StrDupToAnsi(curAgeInfo.ageFilename); + char* ageFilename = StrDupToAnsi(curAgeInfo.GetAgeFilename()); plAgeInfoStruct info; info.SetAgeFilename(ageFilename); free(ageFilename); - + if (RelVaultNode * rvnLink = VaultGetOwnedAgeLinkIncRef(&info)) { if (RelVaultNode * rvnInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { VaultAgeInfoNode ageInfo(rvnInfo); - if (ageInfo.ageInstUuid == curAgeInfo.ageInstUuid) + if (ageInfo.GetAgeInstanceGuid() == curAgeInfo.GetAgeInstanceGuid()) result = true; rvnInfo->DecRef(); @@ -3702,7 +3811,7 @@ void VaultProcessVisitNote(RelVaultNode * rvnVisit) { VaultRegisterVisitAge(&link); } // remove it from the inbox - VaultRemoveChildNode(rvnInbox->nodeId, rvnVisit->nodeId, nil, nil); + VaultRemoveChildNode(rvnInbox->GetNodeId(), rvnVisit->GetNodeId(), nil, nil); rvnVisit->DecRef(); rvnInbox->DecRef(); @@ -3720,7 +3829,7 @@ void VaultProcessUnvisitNote(RelVaultNode * rvnUnVisit) { VaultUnregisterVisitAgeAndWait(&info); } // remove it from the inbox - VaultRemoveChildNode(rvnInbox->nodeId, rvnUnVisit->nodeId, nil, nil); + VaultRemoveChildNode(rvnInbox->GetNodeId(), rvnUnVisit->GetNodeId(), nil, nil); rvnUnVisit->DecRef(); rvnInbox->DecRef(); @@ -3739,7 +3848,7 @@ void VaultProcessPlayerInbox () { tmpAcc.SetNoteType(plVault::kNoteType_Visit); rvnInbox->GetChildNodesIncRef(templateNode, 1, &visits); templateNode->DecRef(); - + for (unsigned i = 0; i < visits.Count(); ++i) { RelVaultNode * rvnVisit = visits[i]; VaultTextNoteNode visitAcc(rvnVisit); @@ -3749,7 +3858,7 @@ void VaultProcessPlayerInbox () { VaultRegisterVisitAge(&link); } // remove it from the inbox - VaultRemoveChildNode(rvnInbox->nodeId, rvnVisit->nodeId, nil, nil); + VaultRemoveChildNode(rvnInbox->GetNodeId(), rvnVisit->GetNodeId(), nil, nil); rvnVisit->DecRef(); } } @@ -3762,7 +3871,7 @@ void VaultProcessPlayerInbox () { tmpAcc.SetNoteType(plVault::kNoteType_UnVisit); rvnInbox->GetChildNodesIncRef(templateNode, 1, &unvisits); templateNode->DecRef(); - + for (unsigned i = 0; i < unvisits.Count(); ++i) { RelVaultNode * rvnUnVisit = unvisits[i]; VaultTextNoteNode unvisitAcc(rvnUnVisit); @@ -3772,7 +3881,7 @@ void VaultProcessPlayerInbox () { VaultUnregisterVisitAgeAndWait(&info); } // remove it from the inbox - VaultRemoveChildNode(rvnInbox->nodeId, rvnUnVisit->nodeId, nil, nil); + VaultRemoveChildNode(rvnInbox->GetNodeId(), rvnUnVisit->GetNodeId(), nil, nil); rvnUnVisit->DecRef(); } } @@ -3825,7 +3934,7 @@ static RelVaultNode * GetAgeInfoNode () { templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_AgeInfo); - templateNode->SetCreatorId(rvnAge->nodeId); + templateNode->SetCreatorId(rvnAge->GetNodeId()); if (RelVaultNode * rvnAgeInfo = rvnAge->GetChildNodeIncRef(templateNode, 1)) { rvnAgeInfo->DecRef(); @@ -3848,7 +3957,7 @@ RelVaultNode * VaultGetAgeInfoNodeIncRef () { NetVaultNode * templateNode = new NetVaultNode; templateNode->IncRef(); templateNode->SetNodeType(plVault::kNodeType_AgeInfo); - templateNode->SetCreatorId(rvnAge->nodeId); + templateNode->SetCreatorId(rvnAge->GetNodeId()); if (RelVaultNode * rvnAgeInfo = rvnAge->GetChildNodeIncRef(templateNode, 1)) result = rvnAgeInfo; @@ -3930,7 +4039,7 @@ RelVaultNode * VaultFindAgeSubAgeLinkIncRef (const plAgeInfoStruct * info) { ageInfo.SetAgeFilename(str); if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - templateNode->fieldFlags = 0; + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeLink); rvnLink = rvnInfo->GetParentNodeIncRef(templateNode, 1); rvnInfo->DecRef(); @@ -3977,10 +4086,10 @@ RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar_t deviceName[]) { break; VaultTextNoteNode access(device); - access.SetNoteType(plVault::kNoteType_Device); + access.SetNoteType(plVault::kNoteType_Device); access.SetNoteTitle(deviceName); - - VaultAddChildNodeAndWait(folder->nodeId, device->nodeId, 0); + + VaultAddChildNodeAndWait(folder->GetNodeId(), device->GetNodeId(), 0); break; } @@ -3999,7 +4108,7 @@ void VaultAgeRemoveDevice (const wchar_t deviceName[]) { VaultTextNoteNode access(templateNode); access.SetNoteTitle(deviceName); if (RelVaultNode * device = folder->GetChildNodeIncRef(templateNode, 1)) { - VaultRemoveChildNode(folder->nodeId, device->nodeId, nil, nil); + VaultRemoveChildNode(folder->GetNodeId(), device->GetNodeId(), nil, nil); device->DecRef(); if (DeviceInbox * deviceInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName))) @@ -4080,11 +4189,11 @@ RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar_t deviceName[], access.SetFolderName(inboxName); access.SetFolderType(plVault::kDeviceInboxFolder); - VaultAddChildNodeAndWait(device->nodeId, inbox->nodeId, 0); + VaultAddChildNodeAndWait(device->GetNodeId(), inbox->GetNodeId(), 0); break; } - return inbox; + return inbox; } //============================================================================ @@ -4134,7 +4243,7 @@ bool VaultAgeGetAgeSDL (plStateDataRecord * out) { VaultSDLNode sdl(rvnSdl); result = sdl.GetStateDataRecord(out, plSDL::kKeepDirty); if (!result) { - sdl.InitStateDataRecord(sdl.sdlName); + sdl.InitStateDataRecord(sdl.GetSDLName()); result = sdl.GetStateDataRecord(out, plSDL::kKeepDirty); } rvnSdl->DecRef(); @@ -4179,7 +4288,7 @@ RelVaultNode * VaultGetSubAgeLinkIncRef (const plAgeInfoStruct * info) { ageInfo.SetAgeFilename(str); if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { - templateNode->fieldFlags = 0; + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeLink); rvnLink = rvnInfo->GetParentNodeIncRef(templateNode, 1); rvnInfo->DecRef(); @@ -4254,7 +4363,7 @@ static void _CreateNodeCallback ( ) { _CreateNodeParam * param = (_CreateNodeParam *)vparam; if (IS_NET_SUCCESS(result)) - param->nodeId = node->nodeId; + param->nodeId = node->GetNodeId(); param->result = result; param->complete = true; } @@ -4298,7 +4407,7 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( unsigned ageLinkId; if (RelVaultNode * rvnSubAges = VaultGetAgeSubAgesFolderIncRef()) { - subAgesId = rvnSubAges->nodeId; + subAgesId = rvnSubAges->GetNodeId(); rvnSubAges->DecRef(); } else { @@ -4446,9 +4555,9 @@ namespace _VaultCreateSubAge { } // Add the children to the right places - VaultAddChildNode(node->nodeId, (uint32_t)((uintptr_t)param), 0, nil, nil); + VaultAddChildNode(node->GetNodeId(), (uint32_t)((uintptr_t)param), 0, nil, nil); if (RelVaultNode* saFldr = VaultGetAgeSubAgesFolderIncRef()) { - VaultAddChildNode(saFldr->nodeId, node->nodeId, 0, nil, nil); + VaultAddChildNode(saFldr->GetNodeId(), node->GetNodeId(), 0, nil, nil); saFldr->DecRef(); } else LogMsg(kLogError, "CreateSubAge: Couldn't find SubAges folder (async)"); @@ -4457,7 +4566,7 @@ namespace _VaultCreateSubAge { plVaultNotifyMsg * msg = new plVaultNotifyMsg; msg->SetType(plVaultNotifyMsg::kRegisteredSubAgeLink); msg->SetResultCode(result); - msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->nodeId); + msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->GetNodeId()); msg->Send(); } @@ -4565,7 +4674,7 @@ static void _CreateNodeCallback ( ) { _CreateNodeParam * param = (_CreateNodeParam *)vparam; if (IS_NET_SUCCESS(result)) - param->nodeId = node->nodeId; + param->nodeId = node->GetNodeId(); param->result = result; param->complete = true; } @@ -4619,7 +4728,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( RelVaultNode * rvnChildAges; if (nil != (rvnChildAges = rvnAgeInfo->GetChildAgeInfoListNodeIncRef(plVault::kChildAgesFolder, 1))) { - childAgesId = rvnChildAges->nodeId; + childAgesId = rvnChildAges->GetNodeId(); } else { rvnAgeInfo->DecRef(); @@ -4640,7 +4749,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( ageInfo.SetAgeFilename(str); if (RelVaultNode * rvnInfo = rvnChildAges->GetChildNodeIncRef(templateNode, 2)) { - templateNode->fieldFlags = 0; + templateNode->ClearFieldFlags(); templateNode->SetNodeType(plVault::kNodeType_AgeLink); rvnLink = rvnInfo->GetParentNodeIncRef(templateNode, 1); rvnInfo->DecRef(); @@ -4664,7 +4773,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( plUUID parentAgeInstId; if (RelVaultNode * rvnAge = VaultGetAgeNodeIncRef()) { VaultAgeNode access(rvnAge); - parentAgeInstId = access.ageInstUuid; + parentAgeInstId = access.GetAgeInstanceGuid(); rvnAge->DecRef(); } @@ -4812,14 +4921,14 @@ namespace _VaultCreateChildAge { _Params* p = (_Params*)param; // Add the children to the right places - VaultAddChildNode(node->nodeId, (uint32_t)((uintptr_t)p->fAgeInfoId), 0, nil, nil); - VaultAddChildNode((uint32_t)((uintptr_t)p->fChildAgesFldr), node->nodeId, 0, nil, nil); + VaultAddChildNode(node->GetNodeId(), (uint32_t)((uintptr_t)p->fAgeInfoId), 0, nil, nil); + VaultAddChildNode((uint32_t)((uintptr_t)p->fChildAgesFldr), node->GetNodeId(), 0, nil, nil); // Send the VaultNotify that the plNetLinkingMgr wants... plVaultNotifyMsg * msg = new plVaultNotifyMsg; msg->SetType(plVaultNotifyMsg::kRegisteredChildAgeLink); msg->SetResultCode(result); - msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->nodeId); + msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->GetNodeId()); msg->Send(); delete (_Params*)param; @@ -4914,11 +5023,11 @@ uint8_t VaultAgeFindOrCreateChildAgeLink( retval = true; } else { _Params* p = new _Params; - p->fChildAgesFldr = (void*)rvnChildAges->nodeId; + p->fChildAgesFldr = (void*)rvnChildAges->GetNodeId(); VaultAgeInfoNode accParentInfo(rvnParentInfo); VaultInitAge(info, - accParentInfo.ageInstUuid, + accParentInfo.GetAgeInstanceGuid(), (FVaultInitAgeCallback)_InitAgeCallback, nil, p @@ -5015,7 +5124,7 @@ void VaultDownloadAndWait ( void VaultCull (unsigned vaultId) { // Remove the node from the global table if (RelVaultNodeLink * link = s_nodes.Find(vaultId)) { - LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId); + LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->GetNodeId()); link->node->state->UnlinkFromRelatives(); delete link; } @@ -5024,7 +5133,7 @@ void VaultCull (unsigned vaultId) { for (RelVaultNodeLink * next, * link = s_nodes.Head(); link; link = next) { next = s_nodes.Next(link); - if (link->node->nodeType > plVault::kNodeType_VNodeMgrLow && link->node->nodeType < plVault::kNodeType_VNodeMgrHigh) + if (link->node->GetNodeType() > plVault::kNodeType_VNodeMgrLow && link->node->GetNodeType() < plVault::kNodeType_VNodeMgrHigh) continue; ARRAY(unsigned) nodeIds; @@ -5032,13 +5141,13 @@ void VaultCull (unsigned vaultId) { bool foundRoot = false; for (unsigned i = 0; i < nodeIds.Count(); ++i) { RelVaultNodeLink * root = s_nodes.Find(nodeIds[i]); - if (root && root->node->nodeType > plVault::kNodeType_VNodeMgrLow && root->node->nodeType < plVault::kNodeType_VNodeMgrHigh) { + if (root && root->node->GetNodeType() > plVault::kNodeType_VNodeMgrLow && root->node->GetNodeType() < plVault::kNodeType_VNodeMgrHigh) { foundRoot = true; break; } } if (!foundRoot) { - LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId); + LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->GetNodeId()); link->node->state->UnlinkFromRelatives(); delete link; } diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp index eac26f4c..09058bf6 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp @@ -67,7 +67,7 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) { unsigned index = 0; while (volatileFieldList[index].nodeType != 0) { - if (node->nodeType == volatileFieldList[index].nodeType) { + if (node->GetNodeType() == volatileFieldList[index].nodeType) { volatileFields |= volatileFieldList[index].volatileFields; break; } @@ -78,204 +78,6 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) { return volatileFields; } -/***************************************************************************** -* -* NetVaultNodeAccess -* -***/ - -//============================================================================ -NetVaultNodeAccess::NetVaultNodeAccess (NetVaultNode * node) -: base(node) -, fieldFlags(node->fieldFlags) -, dirtyFlags(node->dirtyFlags) -{ } - - -/***************************************************************************** -* -* VaultPlayerNode -* -***/ - -//============================================================================ -VaultPlayerNode::VaultPlayerNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, playerName(node->istring64_1) -, avatarShapeName(node->string64_1) -, disabled(node->int32_1) -, explorer(node->int32_2) -, onlineTime(node->uint32_1) -, accountUuid(node->uuid_1) -, inviteUuid(node->uuid_2) -{ -} - -//============================================================================ -void VaultPlayerNode::SetPlayerName (const wchar_t v[]) { - IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultPlayerNode::SetAvatarShapeName (const wchar_t v[]) { - IVaultNodeSetString(kAvatarShapeName, base, &avatarShapeName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultPlayerNode::SetDisabled (int v) { - IVaultNodeSetValue(kDisabled, base, &disabled, v); -} - -//============================================================================ -void VaultPlayerNode::SetOnlineTime (unsigned v) { - IVaultNodeSetValue(kOnlineTime, base, &onlineTime, v); -} - -//============================================================================ -void VaultPlayerNode::SetAccountUuid (const plUUID& v) { - IVaultNodeSetValue(kAccountUuid, base, &accountUuid, v); -} - -//============================================================================ -void VaultPlayerNode::SetInviteUuid (const plUUID& v) { - IVaultNodeSetValue(kInviteUuid, base, &inviteUuid, v); -} - -//============================================================================ -void VaultPlayerNode::SetExplorer (int v) { - IVaultNodeSetValue(kExplorer, base, &explorer, v); -} - - -/***************************************************************************** -* -* VaultPlayerInfoNode -* -***/ - -//============================================================================ -VaultPlayerInfoNode::VaultPlayerInfoNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, playerId(node->uint32_1) -, playerName(node->istring64_1) -, ageInstName(node->string64_1) -, ageInstUuid(node->uuid_1) -, online(node->int32_1) -, ccrLevel(node->int32_2) -{ -} - -//============================================================================ -void VaultPlayerInfoNode::SetPlayerId (unsigned v) { - IVaultNodeSetValue(kPlayerId, base, &playerId, v); -} - -//============================================================================ -void VaultPlayerInfoNode::SetPlayerName (const wchar_t v[]) { - IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultPlayerInfoNode::SetAgeInstName (const wchar_t v[]) { - IVaultNodeSetString(kAgeInstName, base, &ageInstName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultPlayerInfoNode::SetAgeInstUuid (const plUUID& v) { - IVaultNodeSetValue(kAgeInstUuid, base, &ageInstUuid, v); -} - -//============================================================================ -void VaultPlayerInfoNode::SetOnline (int v) { - IVaultNodeSetValue(kOnline, base, &online, v); -} - -//============================================================================ -void VaultPlayerInfoNode::SetCCRLevel (int v) { - IVaultNodeSetValue(kCCRLevel, base, &ccrLevel, v); -} - -/***************************************************************************** -* -* VaultFolderNode -* -***/ - -//============================================================================ -VaultFolderNode::VaultFolderNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, folderType(node->int32_1) -, folderName(node->string64_1) -{ -} - -//============================================================================ -void VaultFolderNode::SetFolderName (const wchar_t v[]) { - IVaultNodeSetString(kFolderName, base, &folderName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultFolderNode::SetFolderType (int v) { - IVaultNodeSetValue(kFolderType, base, &folderType, v); -} - - -/***************************************************************************** -* -* VaultPlayerInfoListNode -* -***/ - -//============================================================================ -VaultPlayerInfoListNode::VaultPlayerInfoListNode (NetVaultNode * node) -: VaultFolderNode(node) -{ -} - - -/***************************************************************************** -* -* VaultAgeInfoListNode -* -***/ - -//============================================================================ -VaultAgeInfoListNode::VaultAgeInfoListNode (NetVaultNode * node) -: VaultFolderNode(node) -{ -} - - -/***************************************************************************** -* -* VaultChronicleNode -* -***/ - -//============================================================================ -VaultChronicleNode::VaultChronicleNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, entryType(node->int32_1) -, entryName(node->string64_1) -, entryValue(node->text_1) -{ -} - -//============================================================================ -void VaultChronicleNode::SetEntryType (int v) { - IVaultNodeSetValue(kEntryType, base, &entryType, v); -} - -//============================================================================ -void VaultChronicleNode::SetEntryName (const wchar_t v[]) { - IVaultNodeSetString(kEntryName, base, &entryName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultChronicleNode::SetEntryValue (const wchar_t v[]) { - IVaultNodeSetString(kEntryValue, base, &entryValue, v, (unsigned)-1); -} - /***************************************************************************** * @@ -283,36 +85,6 @@ void VaultChronicleNode::SetEntryValue (const wchar_t v[]) { * ***/ -//============================================================================ -VaultTextNoteNode::VaultTextNoteNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, noteType(node->int32_1) -, noteSubType(node->int32_2) -, noteTitle(node->string64_1) -, noteText(node->text_1) -{ -} - -//============================================================================ -void VaultTextNoteNode::SetNoteType (int v) { - IVaultNodeSetValue(kNoteType, base, ¬eType, v); -} - -//============================================================================ -void VaultTextNoteNode::SetNoteSubType (int v) { - IVaultNodeSetValue(kNoteSubType, base, ¬eSubType, v); -} - -//============================================================================ -void VaultTextNoteNode::SetNoteTitle (const wchar_t v[]) { - IVaultNodeSetString(kNoteTitle, base, ¬eTitle, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultTextNoteNode::SetNoteText (const wchar_t v[]) { - IVaultNodeSetString(kNoteText, base, ¬eText, v, (unsigned)-1); -} - //============================================================================ enum EAgeInfoFields { kAgeFilename, @@ -415,7 +187,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) { bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { wchar_t * mem; - const wchar_t * str = mem = StrDup(noteText); + const wchar_t * str = mem = StrDup(GetNoteText()); for (unsigned i = 0; i < kNumAgeInfoFields; ++i) { @@ -487,9 +259,9 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { break; DEFAULT_FATAL(i); - } + } } - + free(mem); return true; } @@ -501,42 +273,22 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { * VaultSDLNode * ***/ - -//============================================================================ -VaultSDLNode::VaultSDLNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, sdlIdent(node->int32_1) -, sdlName(node->string64_1) -, sdlData(node->blob_1) -, sdlDataLen(node->blob_1Length) -{ -} - -//============================================================================ -void VaultSDLNode::SetSdlIdent (int v) { - IVaultNodeSetValue(kSDLIdent, base, &sdlIdent, v); -} - -//============================================================================ -void VaultSDLNode::SetSdlName (const wchar_t v[]) { - IVaultNodeSetString(kSDLName, base, &sdlName, v, kMaxVaultNodeStringLength); -} //============================================================================ #ifdef CLIENT bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOptions) { - if (!sdlDataLen || !sdlData) + if (!GetSDLDataLength() || !GetSDLData()) return false; hsRAMStream ram; - ram.Write(sdlDataLen, sdlData); + ram.Write(GetSDLDataLength(), GetSDLData()); ram.Rewind(); - + plString sdlRecName; int sdlRecVersion; if (!plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion)) return false; - + rec->SetDescriptor(sdlRecName, sdlRecVersion); // Note: Setting from default here results in a bug causing age SDL to @@ -562,15 +314,13 @@ void VaultSDLNode::SetStateDataRecord (const plStateDataRecord * rec, unsigned w rec->WriteStreamHeader(&ram); rec->Write(&ram, 0, writeOptions); ram.Rewind(); - + unsigned bytes = ram.GetEOF(); uint8_t * buf = nil; buf = (uint8_t *)malloc(bytes); - ram.CopyToMem(buf); - - IVaultNodeSetBlob(kSDLData, base, &sdlData, &sdlDataLen, buf, bytes); - + ram.CopyToMem(buf); + SetSDLData(buf, bytes); free(buf); } #endif // def CLIENT @@ -585,7 +335,7 @@ void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned wri if (exists) return; } - + char aStr[MAX_PATH]; StrToAnsi(aStr, sdlRecName, arrsize(aStr)); if (plStateDescriptor * des = plSDLMgr::GetInstance()->FindDescriptor(aStr, plSDL::kLatestVersion)) { @@ -603,31 +353,6 @@ void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned wri * ***/ -//============================================================================ -VaultImageNode::VaultImageNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, title(node->string64_1) -, imgType(node->int32_1) -, imgData(node->blob_1) -, imgDataLen(node->blob_1Length) -{ -} - -//============================================================================ -void VaultImageNode::SetImageTitle (const wchar_t v[]) { - IVaultNodeSetString(kImageTitle, base, &title, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultImageNode::SetImageType (int v) { - IVaultNodeSetValue(kImageType, base, &imgType, v); -} - -//============================================================================ -void VaultImageNode::SetImageData (const uint8_t buffer[], unsigned bytes) { - IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes); -} - //============================================================================ #ifdef CLIENT void VaultImageNode::StuffImage (plMipmap * src, int dstType) { @@ -647,14 +372,14 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) { } if (compressSuccess) { - unsigned bytes = ramStream.GetEOF(); + unsigned bytes = ramStream.GetEOF(); uint8_t * buffer = (uint8_t *)malloc(bytes); ramStream.CopyToMem(buffer); - IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes); + SetImageData(buffer, bytes); SetImageType(dstType); free(buffer); } else { - IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, nil, 0); + SetImageData(nil, 0); SetImageType(kNone); } } @@ -664,10 +389,10 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) { #ifdef CLIENT bool VaultImageNode::ExtractImage (plMipmap ** dst) { hsRAMStream ramStream; - ramStream.Write(imgDataLen, imgData); + ramStream.Write(GetImageDataLength(), GetImageData()); ramStream.Rewind(); - switch (imgType) { + switch (GetImageType()) { case kJPEG: (*dst) = plJPEG::Instance().ReadFromStream(&ramStream); break; @@ -707,30 +432,10 @@ struct MatchesSpawnPointName }; #endif -//============================================================================ -VaultAgeLinkNode::VaultAgeLinkNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, unlocked(node->int32_1) -, volat(node->int32_2) -, spawnPoints(node->blob_1) -, spawnPointsLen(node->blob_1Length) -{ -} - -//============================================================================ -void VaultAgeLinkNode::SetUnlocked (int v) { - IVaultNodeSetValue(kUnlocked, base, &unlocked, v); -} - -//============================================================================ -void VaultAgeLinkNode::SetVolatile (int v) { - IVaultNodeSetValue(kVolatile, base, &volat, v); -} - //============================================================================ #ifdef CLIENT bool VaultAgeLinkNode::CopyTo (plAgeLinkStruct * link) { - if (RelVaultNode * me = VaultGetNodeIncRef(base->nodeId)) { + if (RelVaultNode * me = VaultGetNodeIncRef(base->GetNodeId())) { if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { VaultAgeInfoNode access(info); access.CopyTo(link->GetAgeInfo()); @@ -801,7 +506,7 @@ bool VaultAgeLinkNode::HasSpawnPoint (const plSpawnPointInfo & point) const { #ifdef CLIENT void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const { - plString str = plString::FromUtf8(reinterpret_cast(spawnPoints), spawnPointsLen); + plString str = plString::FromUtf8(reinterpret_cast(GetSpawnPoints()), GetSpawnPointsLength()); std::vector izer = str.Tokenize(";"); for (auto token1 = izer.begin(); token1 != izer.end(); ++token1) { @@ -830,132 +535,17 @@ void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) { << in[i].fSpawnPt << ":" << in[i].fCameraStack << ";"; } - IVaultNodeSetBlob( - kSpawnPoints, - base, - &spawnPoints, - &spawnPointsLen, - (const uint8_t *)ss.GetString().c_str(), - ss.GetLength() - ); + plString blob = ss.GetString(); + SetSpawnPoints(reinterpret_cast(blob.c_str()), blob.GetSize()); } #endif -/***************************************************************************** -* -* VaultAgeNode -* -***/ - -//============================================================================ -VaultAgeNode::VaultAgeNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, ageInstUuid(node->uuid_1) -, parentAgeInstUuid(node->uuid_2) -, ageName(node->string64_1) -{ -} - -//============================================================================ -void VaultAgeNode::SetAgeInstGuid (const plUUID& v) { - IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v); -} - -//============================================================================ -void VaultAgeNode::SetParentAgeInstGuid (const plUUID& v) { - IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v); -} - -//============================================================================ -void VaultAgeNode::SetAgeName (const wchar_t v[]) { - IVaultNodeSetString(kAgeName, base, &ageName, v, kMaxVaultNodeStringLength); -} - - /***************************************************************************** * * VaultAgeInfoNode * ***/ -//============================================================================ -VaultAgeInfoNode::VaultAgeInfoNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, ageFilename(node->string64_2) -, ageInstName(node->string64_3) -, ageUserDefinedName(node->string64_4) -, ageInstUuid(node->uuid_1) -, parentAgeInstUuid(node->uuid_2) -, ageSequenceNumber(node->int32_1) -, ageIsPublic(node->int32_2) -, ageLanguage(node->int32_3) -, ageId(node->uint32_1) -, ageCzarId(node->uint32_2) -, ageInfoFlags(node->uint32_3) -, ageDescription(node->text_1) -{ -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeFilename (const wchar_t v[]) { - IVaultNodeSetString(kAgeFilename, base, &ageFilename, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeInstName (const wchar_t v[]) { - IVaultNodeSetString(kAgeInstanceName, base, &ageInstName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeUserDefinedName (const wchar_t v[]) { - IVaultNodeSetString(kAgeUserDefinedName, base, &ageUserDefinedName, v, kMaxVaultNodeStringLength); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeInstGuid (const plUUID& v) { - IVaultNodeSetValue(kAgeInstanceGuid, base, &ageInstUuid, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetParentAgeInstGuid (const plUUID& v) { - IVaultNodeSetValue(kParentAgeInstanceGuid, base, &parentAgeInstUuid, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeSequenceNumber (int v) { - IVaultNodeSetValue(kAgeSequenceNumber, base, &ageSequenceNumber, v); -} - -//============================================================================ -void VaultAgeInfoNode::_SetAgeIsPublic (int v) { - IVaultNodeSetValue(kIsPublic, base, &ageIsPublic, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeLanguage (int v) { - IVaultNodeSetValue(kAgeLanguage, base, &ageLanguage, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeId (unsigned v) { - IVaultNodeSetValue(kAgeId, base, &ageId, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeCzarId (unsigned v) { - IVaultNodeSetValue(kAgeCzarId, base, &ageCzarId, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeInfoFlags (unsigned v) { - IVaultNodeSetValue(kAgeInfoFlags, base, &ageInfoFlags, v); -} - -//============================================================================ -void VaultAgeInfoNode::SetAgeDescription (const wchar_t v[]) { - IVaultNodeSetString(kAgeDescription, base, &ageDescription, v, (unsigned)-1); -} - //============================================================================ #ifdef CLIENT const class plUnifiedTime * VaultAgeInfoNode::GetAgeTime () const { @@ -978,13 +568,13 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) { SetAgeFilename(nil); } - // age instance name + // age instance name if (info->HasAgeInstanceName()) { StrToUnicode(str, info->GetAgeInstanceName(), arrsize(str)); - SetAgeInstName(str); + SetAgeInstanceName(str); } else { - SetAgeInstName(nil); + SetAgeInstanceName(nil); } // age user-defined name @@ -1010,9 +600,9 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) { SetAgeSequenceNumber(info->GetAgeSequenceNumber()); // age instance guid - SetAgeInstGuid(*info->GetAgeInstanceGuid()); + SetAgeInstanceGuid(*info->GetAgeInstanceGuid()); - // age language + // age language SetAgeLanguage(info->GetAgeLanguage()); } #endif // def CLIENT @@ -1022,73 +612,29 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) { void VaultAgeInfoNode::CopyTo (plAgeInfoStruct * info) const { char str[MAX_PATH]; - // age filename - StrToAnsi(str, ageFilename, arrsize(str)); + // age filename + StrToAnsi(str, GetAgeFilename(), arrsize(str)); info->SetAgeFilename(str); - + // age instance name - StrToAnsi(str, ageInstName, arrsize(str)); + StrToAnsi(str, GetAgeInstanceName(), arrsize(str)); info->SetAgeInstanceName(str); - + // age user-defined name - StrToAnsi(str, ageUserDefinedName, arrsize(str)); + StrToAnsi(str, GetAgeUserDefinedName(), arrsize(str)); info->SetAgeUserDefinedName(str); // age description // TODO - + // age sequence number - info->SetAgeSequenceNumber(ageSequenceNumber); - + info->SetAgeSequenceNumber(GetAgeSequenceNumber()); + // age instance guid - plUUID uuid(ageInstUuid); + plUUID uuid(GetAgeInstanceGuid()); info->SetAgeInstanceGuid(&uuid); - + // age language - info->SetAgeLanguage(ageLanguage); + info->SetAgeLanguage(GetAgeLanguage()); } #endif // def CLIENT - - -/***************************************************************************** -* -* VaultSystemNode -* -***/ - -//============================================================================ -VaultSystemNode::VaultSystemNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, ccrStatus(node->int32_1) -{ -} - -//============================================================================ -void VaultSystemNode::SetCCRStatus (int v) { - IVaultNodeSetValue(kCCRStatus, base, &ccrStatus, v); -} - - -/***************************************************************************** -* -* VaultMarkerGameNode -* -***/ - -//============================================================================ -VaultMarkerGameNode::VaultMarkerGameNode (NetVaultNode * node) -: NetVaultNodeAccess(node) -, gameName(node->text_1) -, gameGuid(node->uuid_1) -{ -} - -//============================================================================ -void VaultMarkerGameNode::SetGameName (const wchar_t v[]) { - IVaultNodeSetString(kGameName, base, &gameName, v, (unsigned)-1); -} - -//============================================================================ -void VaultMarkerGameNode::SetGameGuid (const plUUID& v) { - IVaultNodeSetValue(kGameGuid, base, &gameGuid, v); -} diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h index fefdd004..b6ad1675 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h @@ -74,49 +74,38 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node); //============================================================================ struct NetVaultNodeAccess { NetVaultNode * base; - uint64_t & fieldFlags; - uint64_t & dirtyFlags; - NetVaultNodeAccess (NetVaultNode * node); - NetVaultNodeAccess (const NetVaultNodeAccess &); // not implemented - const NetVaultNodeAccess & operator= (const NetVaultNodeAccess &); // not implemented + NetVaultNodeAccess (NetVaultNode * node) : base(node) { } + +private: + NetVaultNodeAccess (const NetVaultNodeAccess &) { } + const NetVaultNodeAccess & operator= (const NetVaultNodeAccess &) { } }; +#define VNODE_ACCESSOR(type, name, basename) \ + static const uint64_t k##name = NetVaultNode::k##basename; \ + type Get##name () const { return base->Get##basename(); } \ + void Set##name (type v) { base->Set##basename(v); } + +#define VNODE_BLOB(name, basename) \ + static const uint64_t k##name = NetVaultNode::k##basename; \ + const uint8_t * Get##name () const { return base->Get##basename(); } \ + size_t Get##name##Length () const { return base->Get##basename##Length(); } \ + void Set##name (const uint8_t data[], size_t length) { base->Set##basename(data, length); } //============================================================================ // VaultPlayerNode //============================================================================ struct VaultPlayerNode : NetVaultNodeAccess { - static const uint64_t kPlayerName = NetVaultNode::kIString64_1; - static const uint64_t kAvatarShapeName = NetVaultNode::kString64_1; - static const uint64_t kDisabled = NetVaultNode::kInt32_1; - static const uint64_t kExplorer = NetVaultNode::kInt32_2; // explorer = 1, visitor = 0 - static const uint64_t kOnlineTime = NetVaultNode::kUInt32_1; - static const uint64_t kAccountUuid = NetVaultNode::kUuid_1; - static const uint64_t kInviteUuid = NetVaultNode::kUuid_2; - - // Treat these as read-only or node flag fields will become invalid - // Threaded apps: Must be accessed with node->critsect locked - wchar_t *& playerName; - wchar_t *& avatarShapeName; - int & disabled; - unsigned & onlineTime; - plUUID& accountUuid; - plUUID& inviteUuid; - int & explorer; - - VaultPlayerNode (NetVaultNode * node); - VaultPlayerNode (const VaultPlayerNode &); // not implemented - const VaultPlayerNode & operator= (const VaultPlayerNode &); // not implemented - - // Threaded apps: Must be called with node->critsect locked - void SetPlayerName (const wchar_t v[]); - void SetAvatarShapeName (const wchar_t v[]); - void SetDisabled (int v); - void SetOnlineTime (unsigned v); - void SetAccountUuid (const plUUID& v); - void SetInviteUuid (const plUUID& v); - void SetExplorer (int v); + VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1); + VNODE_ACCESSOR(const wchar_t *, AvatarShapeName, String64_1); + VNODE_ACCESSOR(int32_t, Disabled, Int32_1); + VNODE_ACCESSOR(int32_t, Explorer, Int32_2); // explorer = 1, visitor = 0 + VNODE_ACCESSOR(uint32_t, OnlineTime, UInt32_1); + VNODE_ACCESSOR(plUUID, AccountUuid, Uuid_1); + VNODE_ACCESSOR(plUUID, InviteUuid, Uuid_2); + + VaultPlayerNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; @@ -124,33 +113,14 @@ struct VaultPlayerNode : NetVaultNodeAccess { // VaultPlayerInfoNode //============================================================================ struct VaultPlayerInfoNode : NetVaultNodeAccess { - static const uint64_t kPlayerId = NetVaultNode::kUInt32_1; - static const uint64_t kPlayerName = NetVaultNode::kIString64_1; - static const uint64_t kAgeInstName = NetVaultNode::kString64_1; // name of age player is currently in - static const uint64_t kAgeInstUuid = NetVaultNode::kUuid_1; // guid of age player is currently in - static const uint64_t kOnline = NetVaultNode::kInt32_1; // whether or not player is online - static const uint64_t kCCRLevel = NetVaultNode::kInt32_2; - - // Treat these as read-only or node flag fields will become invalid - // Threaded apps: Must be accessed with node->critsect locked - unsigned & playerId; - wchar_t *& playerName; - wchar_t *& ageInstName; - plUUID& ageInstUuid; - int & online; - int & ccrLevel; - - VaultPlayerInfoNode (NetVaultNode * node); - VaultPlayerInfoNode (const VaultPlayerInfoNode &); // not implemented - const VaultPlayerInfoNode & operator= (const VaultPlayerInfoNode &); // not implemented - - // Threaded apps: Must be called with node->critsect locked - void SetPlayerId (unsigned v); - void SetPlayerName (const wchar_t v[]); - void SetAgeInstName (const wchar_t v[]); - void SetAgeInstUuid (const plUUID& v); - void SetOnline (int v); - void SetCCRLevel (int v); + VNODE_ACCESSOR(uint32_t, PlayerId, UInt32_1); + VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1); + VNODE_ACCESSOR(const wchar_t *, AgeInstName, String64_1); // name of age player is currently in + VNODE_ACCESSOR(plUUID, AgeInstUuid, Uuid_1); // guid of age player is currently in + VNODE_ACCESSOR(int32_t, Online, Int32_1); // whether or not player is online + VNODE_ACCESSOR(int32_t, CCRLevel, Int32_2); + + VaultPlayerInfoNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; @@ -158,21 +128,10 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess { // VaultFolderNode //============================================================================ struct VaultFolderNode : NetVaultNodeAccess { - static const uint64_t kFolderType = NetVaultNode::kInt32_1; - static const uint64_t kFolderName = NetVaultNode::kString64_1; - - // Treat these as read-only or node flag fields will become invalid - // Threaded apps: Must be accessed with node->critsect locked - int & folderType; - wchar_t *& folderName; - - VaultFolderNode (NetVaultNode * node); - VaultFolderNode (const VaultFolderNode &); // not implemented - const VaultFolderNode & operator= (const VaultFolderNode &); // not implemented - - // Threaded apps: Must be called with node->critsect locked - void SetFolderName (const wchar_t v[]); - void SetFolderType (int v); + VNODE_ACCESSOR(int32_t, FolderType, Int32_1); + VNODE_ACCESSOR(const wchar_t *, FolderName, String64_1); + + VaultFolderNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; @@ -180,44 +139,25 @@ struct VaultFolderNode : NetVaultNodeAccess { // VaultPlayerInfoListNode //============================================================================ struct VaultPlayerInfoListNode : VaultFolderNode { - - VaultPlayerInfoListNode (NetVaultNode * node); - VaultPlayerInfoListNode (const VaultPlayerInfoListNode &); // not implemented - const VaultPlayerInfoListNode & operator= (const VaultPlayerInfoListNode &); // not implemented + VaultPlayerInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { } }; //============================================================================ // VaultAgeInfoListNode //============================================================================ struct VaultAgeInfoListNode : VaultFolderNode { - - VaultAgeInfoListNode (NetVaultNode * node); - VaultAgeInfoListNode (const VaultAgeInfoListNode &); // not implemented - const VaultAgeInfoListNode & operator= (const VaultAgeInfoListNode &); // not implemented + VaultAgeInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { } }; //============================================================================ // VaultChronicleNode //============================================================================ struct VaultChronicleNode : NetVaultNodeAccess { - static const uint64_t kEntryType = NetVaultNode::kInt32_1; - static const uint64_t kEntryName = NetVaultNode::kString64_1; - static const uint64_t kEntryValue = NetVaultNode::kText_1; - - // Treat these as read-only or node flag fields will become invalid - // Threaded apps: Must be accessed with node->critsect locked - int & entryType; - wchar_t *& entryName; - wchar_t *& entryValue; - - VaultChronicleNode (NetVaultNode * node); - VaultChronicleNode (const VaultChronicleNode &); // not implemented - const VaultChronicleNode & operator= (const VaultChronicleNode &); // not implemented - - // Threaded apps: Must be called with node->critsect locked - void SetEntryType (int v); - void SetEntryName (const wchar_t v[]); - void SetEntryValue (const wchar_t v[]); + VNODE_ACCESSOR(int32_t, EntryType, Int32_1); + VNODE_ACCESSOR(const wchar_t *, EntryName, String64_1); + VNODE_ACCESSOR(const wchar_t *, EntryValue, Text_1); + + VaultChronicleNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; @@ -225,21 +165,11 @@ struct VaultChronicleNode : NetVaultNodeAccess { // VaultSDLNode //============================================================================ struct VaultSDLNode : NetVaultNodeAccess { - static const uint64_t kSDLName = NetVaultNode::kString64_1; - static const uint64_t kSDLIdent = NetVaultNode::kInt32_1; - static const uint64_t kSDLData = NetVaultNode::kBlob_1; - - int & sdlIdent; - wchar_t *& sdlName; - uint8_t *& sdlData; - unsigned & sdlDataLen; - - VaultSDLNode (NetVaultNode * node); - VaultSDLNode (const VaultSDLNode &); // not implemented - const VaultSDLNode & operator= (const VaultSDLNode &); // not implemented - - void SetSdlIdent (int v); - void SetSdlName (const wchar_t v[]); + VNODE_ACCESSOR(const wchar_t *, SDLName, String64_1); + VNODE_ACCESSOR(int32_t, SDLIdent, Int32_1); + VNODE_BLOB ( SDLData, Blob_1); + + VaultSDLNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } #ifdef CLIENT bool GetStateDataRecord (class plStateDataRecord * out, unsigned readOptions = 0); @@ -252,21 +182,11 @@ struct VaultSDLNode : NetVaultNodeAccess { // VaultAgeLinkNode //============================================================================ struct VaultAgeLinkNode : NetVaultNodeAccess { - static const uint64_t kUnlocked = NetVaultNode::kInt32_1; - static const uint64_t kVolatile = NetVaultNode::kInt32_2; - static const uint64_t kSpawnPoints = NetVaultNode::kBlob_1; - - int & unlocked; - int & volat; - uint8_t *& spawnPoints; - unsigned & spawnPointsLen; - - VaultAgeLinkNode (NetVaultNode * node); - VaultAgeLinkNode (const VaultAgeLinkNode &); // not implemented - const VaultAgeLinkNode & operator= (const VaultAgeLinkNode &); // not implemented - - void SetUnlocked (int v); - void SetVolatile (int v); + VNODE_ACCESSOR(int32_t, Unlocked, Int32_1); + VNODE_ACCESSOR(int32_t, Volatile, Int32_2); + VNODE_BLOB ( SpawnPoints, Blob_1); + + VaultAgeLinkNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } #ifdef CLIENT bool CopyTo (plAgeLinkStruct * link); @@ -283,26 +203,14 @@ struct VaultAgeLinkNode : NetVaultNodeAccess { // VaultImageNode //============================================================================ struct VaultImageNode : NetVaultNodeAccess { - enum ImageTypes { kNone=0, kJPEG=1, kPNG=2 }; - static const uint64_t kImageType = NetVaultNode::kInt32_1; - static const uint64_t kImageTitle = NetVaultNode::kString64_1; - static const uint64_t kImageData = NetVaultNode::kBlob_1; - - wchar_t *& title; - int & imgType; - uint8_t *& imgData; - unsigned & imgDataLen; - - VaultImageNode (NetVaultNode * node); - VaultImageNode (const VaultImageNode &); // not implemented - const VaultImageNode & operator= (const VaultImageNode &); // not implemented - - void SetImageTitle (const wchar_t v[]); - void SetImageType (int v); - void SetImageData (const uint8_t buffer[], unsigned bytes); - + VNODE_ACCESSOR(int32_t, ImageType, Int32_1); + VNODE_ACCESSOR(const wchar_t *, ImageTitle, String64_1); + VNODE_BLOB ( ImageData, Blob_1); + + VaultImageNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } + #ifdef CLIENT void StuffImage (class plMipmap * src, int dstType=kJPEG); bool ExtractImage (class plMipmap ** dst); @@ -316,9 +224,7 @@ struct VaultImageNode : NetVaultNodeAccess { struct VaultCliImageNode : VaultImageNode { class plMipmap * fMipmap; - VaultCliImageNode (NetVaultNode * node); - VaultCliImageNode (const VaultCliImageNode &); // not implemented - const VaultCliImageNode & operator= (const VaultCliImageNode &); // not implemented + VaultCliImageNode (NetVaultNode * node) : VaultImageNode(node) { } }; #endif // def CLIENT @@ -326,27 +232,14 @@ struct VaultCliImageNode : VaultImageNode { // VaultTextNoteNode //============================================================================ struct VaultTextNoteNode : NetVaultNodeAccess { + VNODE_ACCESSOR(int32_t, NoteType, Int32_1); + VNODE_ACCESSOR(int32_t, NoteSubType, Int32_2); + VNODE_ACCESSOR(const wchar_t *, NoteTitle, String64_1); + VNODE_ACCESSOR(const wchar_t *, NoteText, Text_1); + + VaultTextNoteNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } - static const uint64_t kNoteType = NetVaultNode::kInt32_1; - static const uint64_t kNoteSubType = NetVaultNode::kInt32_2; - static const uint64_t kNoteTitle = NetVaultNode::kString64_1; - static const uint64_t kNoteText = NetVaultNode::kText_1; - - int & noteType; - int & noteSubType; - wchar_t *& noteTitle; - wchar_t *& noteText; - - VaultTextNoteNode (NetVaultNode * node); - VaultTextNoteNode (const VaultTextNoteNode &); // not implemented - const VaultTextNoteNode & operator= (const VaultTextNoteNode &); // not implemented - - void SetNoteType (int v); - void SetNoteSubType (int v); - void SetNoteTitle (const wchar_t v[]); - void SetNoteText (const wchar_t v[]); - -#ifdef CLIENT +#ifdef CLIENT // for kNoteType_Visit/UnVisit void SetVisitInfo (const plAgeInfoStruct & info); bool GetVisitInfo (plAgeInfoStruct * info); @@ -357,72 +250,34 @@ struct VaultTextNoteNode : NetVaultNodeAccess { // VaultAgeNode //============================================================================ struct VaultAgeNode : NetVaultNodeAccess { + VNODE_ACCESSOR(plUUID, AgeInstanceGuid, Uuid_1); + VNODE_ACCESSOR(plUUID, ParentAgeInstanceGuid, Uuid_2); + VNODE_ACCESSOR(const wchar_t *, AgeName, String64_1); - static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1; - static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; - static const uint64_t kAgeName = NetVaultNode::kString64_1; - - plUUID& ageInstUuid; - plUUID& parentAgeInstUuid; - wchar_t *& ageName; - - VaultAgeNode (NetVaultNode * node); - VaultAgeNode (const VaultAgeNode &); // not implemented - const VaultAgeNode & operator= (const VaultAgeNode &); // not implemented - - void SetAgeInstGuid (const plUUID& v); - void SetParentAgeInstGuid (const plUUID& v); - void SetAgeName (const wchar_t v[]); + VaultAgeNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; //============================================================================ // VaultAgeInfoNode //============================================================================ struct VaultAgeInfoNode : NetVaultNodeAccess { + VNODE_ACCESSOR(const wchar_t *, AgeFilename, String64_2); // "Garden" + VNODE_ACCESSOR(const wchar_t *, AgeInstanceName, String64_3); // "Eder Kemo" + VNODE_ACCESSOR(const wchar_t *, AgeUserDefinedName, String64_4); // "Joe's" + VNODE_ACCESSOR(plUUID, AgeInstanceGuid, Uuid_1); // 6278b081-342a-4229-ac1b-a0b8a2658390 + VNODE_ACCESSOR(plUUID, ParentAgeInstanceGuid, Uuid_2); // 9192be7f-89ef-41bc-83db-79afe451e399 + VNODE_ACCESSOR(const wchar_t *, AgeDescription, Text_1); // "Stay out!" + VNODE_ACCESSOR(int32_t, AgeSequenceNumber, Int32_1); + VNODE_ACCESSOR(int32_t, AgeLanguage, Int32_3); // The language of the client that made this age + VNODE_ACCESSOR(uint32_t, AgeId, UInt32_1); + VNODE_ACCESSOR(uint32_t, AgeCzarId, UInt32_2); + VNODE_ACCESSOR(uint32_t, AgeInfoFlags, UInt32_3); + + // WARNING: Do not set this. The age will not be set public this way. Use NetCliAuthSetAgePublic instead (changes this field's value in the process). + VNODE_ACCESSOR(int32_t, IsPublic, Int32_2); + + VaultAgeInfoNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } - static const uint64_t kAgeFilename = NetVaultNode::kString64_2; // "Garden" - static const uint64_t kAgeInstanceName = NetVaultNode::kString64_3; // "Eder Kemo" - static const uint64_t kAgeUserDefinedName = NetVaultNode::kString64_4; // "Joe's" - static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1; // 6278b081-342a-4229-ac1b-a0b8a2658390 - static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; // 9192be7f-89ef-41bc-83db-79afe451e399 - static const uint64_t kAgeDescription = NetVaultNode::kText_1; // "Stay out!" - static const uint64_t kAgeSequenceNumber = NetVaultNode::kInt32_1; - static const uint64_t kIsPublic = NetVaultNode::kInt32_2; - static const uint64_t kAgeLanguage = NetVaultNode::kInt32_3; // The language of the client that made this age - static const uint64_t kAgeId = NetVaultNode::kUInt32_1; - static const uint64_t kAgeCzarId = NetVaultNode::kUInt32_2; - static const uint64_t kAgeInfoFlags = NetVaultNode::kUInt32_3; - - wchar_t *& ageFilename; - wchar_t *& ageInstName; - wchar_t *& ageUserDefinedName; - plUUID& ageInstUuid; - plUUID& parentAgeInstUuid; - int & ageSequenceNumber; - int & ageIsPublic; - int & ageLanguage; - unsigned & ageId; - unsigned & ageCzarId; - unsigned & ageInfoFlags; - wchar_t *& ageDescription; - - VaultAgeInfoNode (NetVaultNode * node); - VaultAgeInfoNode (const VaultAgeInfoNode &); // not implemented - const VaultAgeInfoNode & operator= (const VaultAgeInfoNode &); // not implemented - - void SetAgeFilename (const wchar_t v[]); - void SetAgeInstName (const wchar_t v[]); - void SetAgeUserDefinedName (const wchar_t v[]); - void SetAgeInstGuid (const plUUID& v); - void SetParentAgeInstGuid (const plUUID& v); - void SetAgeSequenceNumber (int v); - void _SetAgeIsPublic (int v); // WARNING: Do not call this. The age will not be set public this way. Use NetCliAuthSetAgePublic instead (changes this field's value in the process). - void SetAgeLanguage (int v); - void SetAgeId (unsigned v); - void SetAgeCzarId (unsigned v); - void SetAgeInfoFlags (unsigned v); - void SetAgeDescription (const wchar_t v[]); - #ifdef CLIENT const class plUnifiedTime * GetAgeTime () const; void CopyFrom (const plAgeInfoStruct * info); @@ -434,16 +289,9 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { // VaultSystemNode //============================================================================ struct VaultSystemNode : NetVaultNodeAccess { + VNODE_ACCESSOR(int32_t, CCRStatus, Int32_1); - static const uint64_t kCCRStatus = NetVaultNode::kInt32_1; - - int & ccrStatus; - - VaultSystemNode (NetVaultNode * node); - VaultSystemNode (const VaultTextNoteNode &); // not implemented - const VaultSystemNode & operator= (const VaultSystemNode &); // not implemented - - void SetCCRStatus (int v); + VaultSystemNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } }; @@ -451,17 +299,8 @@ struct VaultSystemNode : NetVaultNodeAccess { // VaultMarkerGameNode //============================================================================ struct VaultMarkerGameNode : NetVaultNodeAccess { + VNODE_ACCESSOR(const wchar_t *, GameName, Text_1); + VNODE_ACCESSOR(plUUID, GameGuid, Uuid_1); - static const uint64_t kGameName = NetVaultNode::kText_1; - static const uint64_t kGameGuid = NetVaultNode::kUuid_1; - - wchar_t *& gameName; - plUUID& gameGuid; - - VaultMarkerGameNode (NetVaultNode * node); - VaultMarkerGameNode (const VaultMarkerGameNode &); // not implemented - const VaultMarkerGameNode & operator= (const VaultMarkerGameNode &); // not implemented - - void SetGameName (const wchar_t v[]); - void SetGameGuid (const plUUID& v); + VaultMarkerGameNode (NetVaultNode * node) : NetVaultNodeAccess(node) { } };