Browse Source

Merge pull request #250 from zrax/leak-cleanup

Leak cleanup
Adam Johnson 12 years ago
parent
commit
9fe7af9d63
  1. 8
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp
  3. 2
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  4. 4
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
  5. 8
      Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp
  6. 28
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  7. 26
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  8. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp
  9. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp
  10. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp
  11. 12
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp
  12. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp
  13. 80
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  14. 20
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp
  15. 6
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp
  16. 18
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp
  17. 14
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp
  18. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp
  19. 24
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp
  20. 14
      Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp
  21. 2
      Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h
  22. 16
      Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp
  23. 597
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  24. 355
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h
  25. 34
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  26. 2
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  27. 21
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  28. 3
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h
  29. 2
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  30. 19
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  31. 1
      Sources/Plasma/PubUtilLib/plPipeline/plBinkPlayer.h
  32. 413
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  33. 530
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp
  34. 345
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h

8
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2436,15 +2436,15 @@ void cyMisc::RemovePublicAge( const char * ageInstanceGuid, PyObject * cbObject/
int cyMisc::GetKILevel() int cyMisc::GetKILevel()
{ {
int result = pfKIMsg::kNanoKI; int result = pfKIMsg::kNanoKI;
wchar_t wStr[MAX_PATH]; wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr)); StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr));
if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) {
VaultChronicleNode chron(rvn); VaultChronicleNode chron(rvn);
result = wcstol(chron.entryValue, nil, 0); result = wcstol(chron.GetEntryValue(), nil, 0);
rvn->DecRef(); rvn->DecRef();
} }
return result; return result;
} }
@ -2828,7 +2828,7 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef()) if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef())
{ {
VaultPlayerNode player(pNode); 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 we don't have an invite UUID set then make a new one
if (inviteUuid.IsNull()) if (inviteUuid.IsNull())

2
Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp

@ -1194,7 +1194,7 @@ void PythonInterface::initPython()
getOutputAndReset(&error); getOutputAndReset(&error);
} }
#ifndef BUILDING_PYPLASMA #ifndef BUILDING_PYPLASMA
// Begin PEP 302 Import Hook stuff // Begin PEP 302 Import Hook stuff
// We need to create a ptImportHook object // We need to create a ptImportHook object
ptImportHook* hook = PyObject_New(ptImportHook, &ptImportHook_type); ptImportHook* hook = PyObject_New(ptImportHook, &ptImportHook_type);

2
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp

@ -189,7 +189,7 @@ plUUID pyAgeVault::GetAgeGuid( void )
RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef(); RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef();
if (rvn) { if (rvn) {
VaultAgeInfoNode ageInfo(rvn); VaultAgeInfoNode ageInfo(rvn);
plUUID uuid = plUUID(ageInfo.ageInstUuid); plUUID uuid = ageInfo.GetAgeInstanceGuid();
rvn->DecRef(); rvn->DecRef();
return uuid; return uuid;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp

@ -94,7 +94,7 @@ const char * pyDniInfoSource::GetAgeName( void ) const
VaultAgeInfoNode ageInfo(node); VaultAgeInfoNode ageInfo(node);
fAgeName = StrDupToAnsi(ageInfo.ageInstName); fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName());
node->DecRef(); node->DecRef();
return fAgeName; return fAgeName;
@ -105,7 +105,7 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const
if (RelVaultNode * node = VaultGetAgeInfoNodeIncRef()) if (RelVaultNode * node = VaultGetAgeInfoNodeIncRef())
{ {
VaultAgeInfoNode ageInfo(node); VaultAgeInfoNode ageInfo(node);
plUUID uuid = plUUID(ageInfo.ageInstUuid); plUUID uuid = ageInfo.GetAgeInstanceGuid();
node->DecRef(); node->DecRef();
return uuid; return uuid;

8
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()) if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef())
{ {
uint32_t ownerId = ageInfo->nodeId; uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
ageInfo->DecRef(); ageInfo->DecRef();
} else } else
@ -143,7 +143,7 @@ void pyGameScore::CreatePlayerScore(const plString& name, uint32_t type, int32_t
{ {
if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef()) if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef())
{ {
uint32_t ownerId = node->nodeId; uint32_t ownerId = node->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
node->DecRef(); node->DecRef();
} else } else
@ -159,7 +159,7 @@ void pyGameScore::FindAgeScores(const plString& name, pyKey& rcvr)
{ {
if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef()) if (RelVaultNode* ageInfo = VaultGetAgeInfoNodeIncRef())
{ {
uint32_t ownerId = ageInfo->nodeId; uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey()); pfGameScore::Find(ownerId, name, rcvr.getKey());
ageInfo->DecRef(); ageInfo->DecRef();
} else } else
@ -175,7 +175,7 @@ void pyGameScore::FindPlayerScores(const plString& name, pyKey& rcvr)
{ {
if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef()) if (RelVaultNode* node = VaultGetPlayerInfoNodeIncRef())
{ {
uint32_t ownerId = node->nodeId; uint32_t ownerId = node->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey()); pfGameScore::Find(ownerId, name, rcvr.getKey());
node->DecRef(); node->DecRef();
} }

28
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -225,11 +225,11 @@ PyObject* pyVault::GetKIUsage(void)
RelVaultNode ** end = nodeArr.Term(); RelVaultNode ** end = nodeArr.Term();
for (; cur != end; ++cur) { for (; cur != end; ++cur) {
RelVaultNode * rvn = *cur; RelVaultNode * rvn = *cur;
if (rvn->nodeType == plVault::kNodeType_Image) if (rvn->GetNodeType() == plVault::kNodeType_Image)
++pictures; ++pictures;
else if (rvn->nodeType == plVault::kNodeType_TextNote) else if (rvn->GetNodeType() == plVault::kNodeType_TextNote)
++notes; ++notes;
else if (rvn->nodeType == plVault::kNodeType_MarkerGame) else if (rvn->GetNodeType() == plVault::kNodeType_MarkerGame)
++markerGames; ++markerGames;
rvn->DecRef(); rvn->DecRef();
} }
@ -385,7 +385,7 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName )
StrToUnicode(wDevName, deviceName, arrsize(wDevName)); StrToUnicode(wDevName, deviceName, arrsize(wDevName));
// Note: This actually blocks (~Hoikas) // 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; PyObject * result = nil;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->IncRef();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
templateNode->fieldFlags = 0; templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo); templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode); VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH]; wchar_t str[MAX_PATH];
@ -444,8 +444,8 @@ PyObject* pyVault::GetPsnlAgeSDL() const
ageInfo.SetAgeFilename(str); ageInfo.SetAgeFilename(str);
if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) {
templateNode->fieldFlags = 0; templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_SDL); templateNode->SetNodeType(plVault::kNodeType_SDL);
if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) {
@ -478,10 +478,10 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->IncRef();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
templateNode->fieldFlags = 0; templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo); templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode); VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH]; wchar_t str[MAX_PATH];
@ -489,8 +489,8 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
ageInfo.SetAgeFilename(str); ageInfo.SetAgeFilename(str);
if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) { if (RelVaultNode * rvnInfo = rvnFldr->GetChildNodeIncRef(templateNode, 2)) {
templateNode->fieldFlags = 0; templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_SDL); templateNode->SetNodeType(plVault::kNodeType_SDL);
if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) {

26
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp

@ -189,7 +189,7 @@ const char * pyVaultAgeInfoNode::GetAgeFilename() const
if (fNode) { if (fNode) {
char str[MAX_PATH]; char str[MAX_PATH];
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageFilename, arrsize(str)); StrToAnsi(str, access.GetAgeFilename(), arrsize(str));
fAgeFilename = str; fAgeFilename = str;
} }
return fAgeFilename.c_str(); return fAgeFilename.c_str();
@ -204,7 +204,7 @@ const char * pyVaultAgeInfoNode::GetAgeInstanceName() const
if (fNode) { if (fNode) {
char str[MAX_PATH]; char str[MAX_PATH];
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageInstName, arrsize(str)); StrToAnsi(str, access.GetAgeInstanceName(), arrsize(str));
fAgeInstName = str; fAgeInstName = str;
} }
return fAgeInstName.c_str(); return fAgeInstName.c_str();
@ -219,7 +219,7 @@ const char * pyVaultAgeInfoNode::GetAgeUserDefinedName() const
if (fNode) { if (fNode) {
char str[MAX_PATH]; char str[MAX_PATH];
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageUserDefinedName, arrsize(str)); StrToAnsi(str, access.GetAgeUserDefinedName(), arrsize(str));
fAgeUserName = str; fAgeUserName = str;
} }
return fAgeUserName.c_str(); return fAgeUserName.c_str();
@ -234,7 +234,7 @@ plUUID pyVaultAgeInfoNode::GetAgeInstanceGuid() const
if (fNode) { if (fNode) {
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
return plUUID(access.ageInstUuid); return access.GetAgeInstanceGuid();
} }
return kNilUuid; return kNilUuid;
} }
@ -249,7 +249,7 @@ const char * pyVaultAgeInfoNode::GetAgeDescription() const
char str[MAX_PATH]; char str[MAX_PATH];
memset(str, 0, sizeof(str)); memset(str, 0, sizeof(str));
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.ageDescription, arrsize(str)); StrToAnsi(str, access.GetAgeDescription(), arrsize(str));
fAgeDescription = str; fAgeDescription = str;
} }
return fAgeDescription.c_str(); return fAgeDescription.c_str();
@ -263,9 +263,9 @@ int32_t pyVaultAgeInfoNode::GetSequenceNumber() const
{ {
if (!fNode) if (!fNode)
return -1; return -1;
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
return access.ageSequenceNumber; return access.GetAgeSequenceNumber();
} }
void pyVaultAgeInfoNode::SetSequenceNumber( int32_t v ) void pyVaultAgeInfoNode::SetSequenceNumber( int32_t v )
@ -276,9 +276,9 @@ int32_t pyVaultAgeInfoNode::GetAgeLanguage() const
{ {
if (!fNode) if (!fNode)
return -1; return -1;
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
return access.ageLanguage; return access.GetAgeLanguage();
} }
void pyVaultAgeInfoNode::SetAgeLanguage( int32_t v ) void pyVaultAgeInfoNode::SetAgeLanguage( int32_t v )
@ -305,7 +305,7 @@ bool pyVaultAgeInfoNode::IsPublic() const
{ {
if (fNode) { if (fNode) {
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
return access.ageIsPublic; return access.GetIsPublic();
} }
return false; return false;
} }
@ -315,10 +315,10 @@ const char * pyVaultAgeInfoNode::GetDisplayName() const
if (fNode) { if (fNode) {
char str[MAX_PATH]; char str[MAX_PATH];
VaultAgeInfoNode access(fNode); VaultAgeInfoNode access(fNode);
if (access.ageSequenceNumber > 0) if (access.GetAgeSequenceNumber() > 0)
StrPrintf(str, arrsize(str), "%S(%d) %S", access.ageUserDefinedName, access.ageSequenceNumber, access.ageInstName); StrPrintf(str, arrsize(str), "%S(%d) %S", access.GetAgeUserDefinedName(), access.GetAgeSequenceNumber(), access.GetAgeInstanceName());
else else
StrPrintf(str, arrsize(str), "%S %S", access.ageUserDefinedName, access.ageInstName); StrPrintf(str, arrsize(str), "%S %S", access.GetAgeUserDefinedName(), access.GetAgeInstanceName());
fAgeDispName = str; fAgeDispName = str;
} }
return fAgeDispName.c_str(); return fAgeDispName.c_str();

4
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp

@ -109,7 +109,7 @@ bool pyVaultAgeLinkNode::GetLocked() const
return false; return false;
VaultAgeLinkNode access(fNode); VaultAgeLinkNode access(fNode);
return !access.unlocked; return !access.GetUnlocked();
} }
void pyVaultAgeLinkNode::SetVolatile( bool v ) void pyVaultAgeLinkNode::SetVolatile( bool v )
@ -127,7 +127,7 @@ bool pyVaultAgeLinkNode::GetVolatile() const
return false; return false;
VaultAgeLinkNode access(fNode); VaultAgeLinkNode access(fNode);
return access.volat; return access.GetVolatile();
} }
void pyVaultAgeLinkNode::AddSpawnPoint( pySpawnPointInfo & point ) void pyVaultAgeLinkNode::AddSpawnPoint( pySpawnPointInfo & point )

8
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp

@ -97,7 +97,7 @@ const char * pyVaultChronicleNode::Chronicle_GetName( void )
free(ansiName); free(ansiName);
VaultChronicleNode chron(fNode); VaultChronicleNode chron(fNode);
ansiName = StrDupToAnsi(chron.entryName); ansiName = StrDupToAnsi(chron.GetEntryName());
return ansiName; return ansiName;
} }
@ -123,10 +123,10 @@ const char * pyVaultChronicleNode::Chronicle_GetValue( void )
VaultChronicleNode chron(fNode); VaultChronicleNode chron(fNode);
if (!chron.entryValue) if (!chron.GetEntryValue())
return ""; return "";
ansiValue = StrDupToAnsi(chron.entryValue); ansiValue = StrDupToAnsi(chron.GetEntryValue());
return ansiValue; return ansiValue;
} }
@ -145,5 +145,5 @@ uint32_t pyVaultChronicleNode::Chronicle_GetType( void )
return 0; return 0;
VaultChronicleNode chron(fNode); VaultChronicleNode chron(fNode);
return chron.entryType; return chron.GetEntryType();
} }

10
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp

@ -84,7 +84,7 @@ int pyVaultFolderNode::Folder_GetType( void )
return 0; return 0;
VaultFolderNode folder(fNode); VaultFolderNode folder(fNode);
return folder.folderType; return folder.GetFolderType();
} }
void pyVaultFolderNode::Folder_SetName( std::string name ) void pyVaultFolderNode::Folder_SetName( std::string name )
@ -113,11 +113,11 @@ std::string pyVaultFolderNode::Folder_GetName( void )
return ""; return "";
VaultFolderNode folder(fNode); VaultFolderNode folder(fNode);
if (!folder.folderName) if (!folder.GetFolderName())
return ""; return "";
std::string retVal; std::string retVal;
char* sName = hsWStringToString(folder.folderName); char* sName = hsWStringToString(folder.GetFolderName());
retVal = sName; retVal = sName;
delete [] sName; delete [] sName;
return retVal; return retVal;
@ -129,8 +129,8 @@ std::wstring pyVaultFolderNode::Folder_GetNameW( void )
return L""; return L"";
VaultFolderNode folder(fNode); VaultFolderNode folder(fNode);
if (!folder.folderName) if (!folder.GetFolderName())
return L""; return L"";
return folder.folderName; return folder.GetFolderName();
} }

12
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp

@ -141,9 +141,9 @@ std::string pyVaultImageNode::Image_GetTitle( void )
VaultImageNode image(fNode); VaultImageNode image(fNode);
std::string retVal = ""; std::string retVal = "";
if (image.title) if (image.GetImageTitle())
{ {
char* temp = hsWStringToString(image.title); char* temp = hsWStringToString(image.GetImageTitle());
retVal = temp; retVal = temp;
delete [] temp; delete [] temp;
} }
@ -157,7 +157,7 @@ std::wstring pyVaultImageNode::Image_GetTitleW( void )
return L""; return L"";
VaultImageNode image(fNode); VaultImageNode image(fNode);
return image.title ? image.title : L""; return image.GetImageTitle() ? image.GetImageTitle() : L"";
} }
PyObject* pyVaultImageNode::Image_GetImage( void ) PyObject* pyVaultImageNode::Image_GetImage( void )
@ -170,7 +170,7 @@ PyObject* pyVaultImageNode::Image_GetImage( void )
if (access.ExtractImage(&fMipmap)) { if (access.ExtractImage(&fMipmap)) {
fMipmapKey = fMipmap->GetKey(); fMipmapKey = fMipmap->GetKey();
if (!fMipmapKey) if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else else
fMipmapKey->RefObject(); fMipmapKey->RefObject();
} }
@ -199,7 +199,7 @@ void pyVaultImageNode::Image_SetImage(pyImage& image)
fMipmapKey = image.GetKey(); fMipmapKey = image.GetKey();
if (!fMipmapKey) if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else else
fMipmapKey->RefObject(); fMipmapKey->RefObject();
} }
@ -243,7 +243,7 @@ void pyVaultImageNode::SetImageFromScrShot()
if (cyMisc::GetPipeline()->CaptureScreen(fMipmap, false, 800, 600)) { if (cyMisc::GetPipeline()->CaptureScreen(fMipmap, false, 800, 600)) {
fMipmapKey = fMipmap->GetKey(); fMipmapKey = fMipmap->GetKey();
if (!fMipmapKey) if (!fMipmapKey)
fMipmapKey = CreateAndRefImageKey(fNode->nodeId, fMipmap); fMipmapKey = CreateAndRefImageKey(fNode->GetNodeId(), fMipmap);
else else
fMipmapKey->RefObject(); fMipmapKey->RefObject();
access.StuffImage(fMipmap); access.StuffImage(fMipmap);

4
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp

@ -74,7 +74,7 @@ const char * pyVaultMarkerGameNode::GetGameName () const
if (fNode) { if (fNode) {
VaultMarkerGameNode access(fNode); VaultMarkerGameNode access(fNode);
StrToAnsi(fGameName, access.gameName, arrsize(fGameName)); StrToAnsi(fGameName, access.GetGameName(), arrsize(fGameName));
} }
return fGameName; return fGameName;
} }
@ -93,7 +93,7 @@ plUUID pyVaultMarkerGameNode::GetGameGuid() const
{ {
if (fNode) { if (fNode) {
VaultMarkerGameNode access(fNode); VaultMarkerGameNode access(fNode);
return access.gameGuid; return access.GetGameGuid();
} }
return kNilUuid; return kNilUuid;
} }

80
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -208,7 +208,7 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
return true; return true;
if (ours == nil || theirs == nil) if (ours == nil || theirs == nil)
return false; return false;
if (ours->nodeId == theirs->nodeId) if (ours->GetNodeId() == theirs->GetNodeId())
return true; return true;
return ours->Matches(theirs); return ours->Matches(theirs);
} }
@ -217,14 +217,14 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
uint32_t pyVaultNode::GetID( void ) uint32_t pyVaultNode::GetID( void )
{ {
if (fNode) if (fNode)
return fNode->nodeId; return fNode->GetNodeId();
return 0; return 0;
} }
uint32_t pyVaultNode::GetType( void ) uint32_t pyVaultNode::GetType( void )
{ {
if (fNode) if (fNode)
return fNode->nodeType; return fNode->GetNodeType();
return 0; return 0;
} }
@ -254,14 +254,14 @@ PyObject* pyVaultNode::GetOwnerNode( void )
uint32_t pyVaultNode::GetModifyTime( void ) uint32_t pyVaultNode::GetModifyTime( void )
{ {
if (fNode) if (fNode)
return fNode->modifyTime; return fNode->GetModifyTime();
return 0; return 0;
} }
uint32_t pyVaultNode::GetCreatorNodeID( void ) uint32_t pyVaultNode::GetCreatorNodeID( void )
{ {
if (fNode) if (fNode)
return fNode->creatorId; return fNode->GetCreatorId();
return 0; return 0;
} }
@ -274,7 +274,7 @@ PyObject* pyVaultNode::GetCreatorNode( void )
templateNode->IncRef(); templateNode->IncRef();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode plrInfo(templateNode); VaultPlayerInfoNode plrInfo(templateNode);
plrInfo.SetPlayerId(fNode->creatorId); plrInfo.SetPlayerId(fNode->GetCreatorId());
if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) { if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) {
result = pyVaultPlayerInfoNode::New(rvn); result = pyVaultPlayerInfoNode::New(rvn);
@ -293,7 +293,7 @@ PyObject* pyVaultNode::GetCreatorNode( void )
uint32_t pyVaultNode::GetCreateTime( void ) uint32_t pyVaultNode::GetCreateTime( void )
{ {
if (fNode) if (fNode)
return fNode->createTime; return fNode->GetCreateTime();
return 0; return 0;
} }
@ -314,8 +314,8 @@ const char * pyVaultNode::GetCreateAgeName( void )
return fCreateAgeName; return fCreateAgeName;
if (fNode) { if (fNode) {
if (fNode->createAgeName) if (fNode->GetCreateAgeName())
fCreateAgeName = StrDupToAnsi(fNode->createAgeName); fCreateAgeName = StrDupToAnsi(fNode->GetCreateAgeName());
else else
fCreateAgeName = StrDup(""); fCreateAgeName = StrDup("");
} }
@ -326,7 +326,7 @@ const char * pyVaultNode::GetCreateAgeName( void )
plUUID pyVaultNode::GetCreateAgeGuid(void) const plUUID pyVaultNode::GetCreateAgeGuid(void) const
{ {
if (fNode) { if (fNode) {
return fNode->createAgeUuid; return fNode->GetCreateAgeUuid();
} }
return kNilUuid; return kNilUuid;
@ -336,7 +336,7 @@ PyObject* pyVaultNode::GetCreateAgeCoords () {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyDniCoordinates::New(nil); return pyDniCoordinates::New(nil);
} }
void pyVaultNode::SetID( uint32_t v ) void pyVaultNode::SetID( uint32_t v )
@ -347,7 +347,7 @@ void pyVaultNode::SetID( uint32_t v )
void pyVaultNode::SetType( int v ) void pyVaultNode::SetType( int v )
{ {
ASSERT(fNode); ASSERT(fNode);
if (fNode->nodeId) { if (fNode->GetNodeId()) {
FATAL("pyVaultNode: You may not change the type of a vault node"); FATAL("pyVaultNode: You may not change the type of a vault node");
return; return;
} }
@ -363,7 +363,7 @@ void pyVaultNode::SetOwnerNodeID( uint32_t v )
void pyVaultNode::SetCreatorNodeID( uint32_t v ) void pyVaultNode::SetCreatorNodeID( uint32_t v )
{ {
ASSERT(fNode); ASSERT(fNode);
if (fNode->nodeId) { if (fNode->GetNodeId()) {
FATAL("pyVaultNode: You may not change the type of a vault node"); FATAL("pyVaultNode: You may not change the type of a vault node");
return; return;
} }
@ -415,7 +415,7 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
if ( !pynode->GetID() ) if ( !pynode->GetID() )
{ {
// Block here until node is created and fetched =( // Block here until node is created and fetched =(
ASSERT(pynode->GetNode()->nodeType); ASSERT(pynode->GetNode()->GetNodeType());
ENetError result; ENetError result;
RelVaultNode * newNode = VaultCreateNodeAndWaitIncRef( RelVaultNode * newNode = VaultCreateNodeAndWaitIncRef(
pynode->GetNode(), pynode->GetNode(),
@ -435,10 +435,10 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode); PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode);
Py_INCREF(nodeRef); // The callback steals the ref, according to Eric... Py_INCREF(nodeRef); // The callback steals the ref, according to Eric...
cb->SetNode(pynode->fNode); cb->SetNode(pynode->fNode);
VaultAddChildNode(fNode->nodeId, VaultAddChildNode(fNode->GetNodeId(),
pynode->fNode->nodeId, pynode->fNode->GetNodeId(),
NetCommGetPlayer()->playerInt, NetCommGetPlayer()->playerInt,
(FVaultAddChildNodeCallback)_AddNodeCallback, (FVaultAddChildNodeCallback)_AddNodeCallback,
cb cb
); );
@ -474,8 +474,8 @@ void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, uint32_t cbContext)
rvn->DecRef(); rvn->DecRef();
} }
VaultAddChildNode(fNode->nodeId, VaultAddChildNode(fNode->GetNodeId(),
nodeID, nodeID,
NetCommGetPlayer()->playerInt, NetCommGetPlayer()->playerInt,
(FVaultAddChildNodeCallback)_AddNodeCallback, (FVaultAddChildNodeCallback)_AddNodeCallback,
cb cb
@ -499,7 +499,7 @@ bool pyVaultNode::RemoveNode( pyVaultNode& pynode, PyObject* cbObject, uint32_t
// Hack the callbacks until vault notification is in place // Hack the callbacks until vault notification is in place
cb->VaultOperationStarted( cbContext ); cb->VaultOperationStarted( cbContext );
VaultRemoveChildNode(fNode->nodeId, pynode.fNode->nodeId, nil, nil); VaultRemoveChildNode(fNode->GetNodeId(), pynode.fNode->GetNodeId(), nil, nil);
cb->SetNode(pynode.fNode); cb->SetNode(pynode.fNode);
cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode.fNode); cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode.fNode);
@ -525,7 +525,7 @@ void pyVaultNode::RemoveAllNodes( void )
ARRAY(unsigned) nodeIds; ARRAY(unsigned) nodeIds;
fNode->GetChildNodeIds(&nodeIds, 1); fNode->GetChildNodeIds(&nodeIds, 1);
for (unsigned i = 0; i < nodeIds.Count(); ++i) 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 // 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, // 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. // 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; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->DecRef();
@ -557,7 +557,7 @@ void pyVaultNode::SaveAll(PyObject* cbObject, uint32_t cbContext)
void pyVaultNode::ForceSave() void pyVaultNode::ForceSave()
{ {
if (!fNode->nodeId && fNode->nodeType) { if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->DecRef();
@ -576,7 +576,7 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t
if (fNode) if (fNode)
{ {
// If the node doesn't have an id, then use it as a template to create the node in the vault, // 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; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->DecRef();
@ -717,9 +717,9 @@ PyObject* pyVaultNode::UpcastToFolderNode()
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if ( if (
fNode->nodeType != plVault::kNodeType_Folder && fNode->GetNodeType() != plVault::kNodeType_Folder &&
fNode->nodeType != plVault::kNodeType_AgeInfoList && fNode->GetNodeType() != plVault::kNodeType_AgeInfoList &&
fNode->nodeType != plVault::kNodeType_PlayerInfoList fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList
) )
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
@ -730,7 +730,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoListNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_PlayerInfoList) if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfoList)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultPlayerInfoListNode::New(fNode); return pyVaultPlayerInfoListNode::New(fNode);
@ -740,7 +740,7 @@ PyObject* pyVaultNode::UpcastToImageNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_Image) if (fNode->GetNodeType() != plVault::kNodeType_Image)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultImageNode::New(fNode); return pyVaultImageNode::New(fNode);
@ -750,7 +750,7 @@ PyObject* pyVaultNode::UpcastToTextNoteNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_TextNote) if (fNode->GetNodeType() != plVault::kNodeType_TextNote)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultTextNoteNode::New(fNode); return pyVaultTextNoteNode::New(fNode);
@ -760,7 +760,7 @@ PyObject* pyVaultNode::UpcastToAgeLinkNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeLink) if (fNode->GetNodeType() != plVault::kNodeType_AgeLink)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultAgeLinkNode::New(fNode); return pyVaultAgeLinkNode::New(fNode);
@ -770,7 +770,7 @@ PyObject* pyVaultNode::UpcastToChronicleNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_Chronicle) if (fNode->GetNodeType() != plVault::kNodeType_Chronicle)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultChronicleNode::New(fNode); return pyVaultChronicleNode::New(fNode);
@ -780,7 +780,7 @@ PyObject* pyVaultNode::UpcastToPlayerInfoNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_PlayerInfo) if (fNode->GetNodeType() != plVault::kNodeType_PlayerInfo)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultPlayerInfoNode::New(fNode); return pyVaultPlayerInfoNode::New(fNode);
@ -790,7 +790,7 @@ PyObject* pyVaultNode::UpcastToMarkerGameNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_MarkerGame) if (fNode->GetNodeType() != plVault::kNodeType_MarkerGame)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultMarkerGameNode::New(fNode); return pyVaultMarkerGameNode::New(fNode);
@ -800,7 +800,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeInfo) if (fNode->GetNodeType() != plVault::kNodeType_AgeInfo)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultAgeInfoNode::New(fNode); return pyVaultAgeInfoNode::New(fNode);
@ -810,7 +810,7 @@ PyObject* pyVaultNode::UpcastToAgeInfoListNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_AgeInfoList) if (fNode->GetNodeType() != plVault::kNodeType_AgeInfoList)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultAgeInfoListNode::New(fNode); return pyVaultAgeInfoListNode::New(fNode);
@ -820,7 +820,7 @@ PyObject* pyVaultNode::UpcastToSDLNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_SDL) if (fNode->GetNodeType() != plVault::kNodeType_SDL)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultSDLNode::New(fNode); return pyVaultSDLNode::New(fNode);
@ -830,7 +830,7 @@ PyObject* pyVaultNode::UpcastToPlayerNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_VNodeMgrPlayer) if (fNode->GetNodeType() != plVault::kNodeType_VNodeMgrPlayer)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultPlayerNode::New(fNode); return pyVaultPlayerNode::New(fNode);
@ -841,7 +841,7 @@ PyObject* pyVaultNode::UpcastToSystemNode()
{ {
if (!fNode) if (!fNode)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
if (fNode->nodeType != plVault::kNodeType_System) if (fNode->GetNodeType() != plVault::kNodeType_System)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
return pyVaultSystemNode::New(fNode); return pyVaultSystemNode::New(fNode);

20
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp

@ -99,22 +99,22 @@ PyObject* pyVaultNodeRef::GetChild( void )
unsigned pyVaultNodeRef::GetParentID () { unsigned pyVaultNodeRef::GetParentID () {
if (!fParent) if (!fParent)
return 0; return 0;
return fParent->nodeId; return fParent->GetNodeId();
} }
unsigned pyVaultNodeRef::GetChildID () { unsigned pyVaultNodeRef::GetChildID () {
if (!fChild) if (!fChild)
return 0; return 0;
return fChild->nodeId; return fChild->GetNodeId();
} }
unsigned pyVaultNodeRef::GetSaverID () { unsigned pyVaultNodeRef::GetSaverID () {
if (!fParent || !fChild) if (!fParent || !fChild)
return 0; return 0;
unsigned saverId = 0; unsigned saverId = 0;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) { if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) {
saverId = child->GetRefOwnerId(fParent->nodeId); saverId = child->GetRefOwnerId(fParent->GetNodeId());
child->DecRef(); child->DecRef();
} }
return saverId; return saverId;
@ -124,9 +124,9 @@ PyObject * pyVaultNodeRef::GetSaver () {
if (!fParent || !fChild) if (!fParent || !fChild)
return 0; return 0;
RelVaultNode * saver = nil; RelVaultNode * saver = nil;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->nodeId)) { if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) {
if (unsigned saverId = child->GetRefOwnerId(fParent->nodeId)) { if (unsigned saverId = child->GetRefOwnerId(fParent->GetNodeId())) {
// Find the player info node representing the saver // Find the player info node representing the saver
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->IncRef();
@ -163,6 +163,6 @@ bool pyVaultNodeRef::BeenSeen () {
void pyVaultNodeRef::SetSeen (bool v) { void pyVaultNodeRef::SetSeen (bool v) {
if (!fParent || !fChild) if (!fParent || !fChild)
return; return;
fParent->SetSeen(fChild->nodeId, v); fParent->SetSeen(fChild->GetNodeId(), v);
} }

6
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp

@ -114,7 +114,7 @@ bool pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
VaultFindNodesAndWait(templateNode, &nodeIds); VaultFindNodesAndWait(templateNode, &nodeIds);
if (nodeIds.Count()) if (nodeIds.Count())
VaultAddChildNodeAndWait(fNode->nodeId, nodeIds[0], VaultGetPlayerId()); VaultAddChildNodeAndWait(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId());
templateNode->DecRef(); templateNode->DecRef();
return nodeIds.Count() != 0; return nodeIds.Count() != 0;
@ -130,9 +130,9 @@ void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID); access.SetPlayerId(playerID);
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) {
VaultRemoveChildNode(fNode->nodeId, rvn->nodeId, nil, nil); VaultRemoveChildNode(fNode->GetNodeId(), rvn->GetNodeId(), nil, nil);
rvn->DecRef(); rvn->DecRef();
} }

18
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp

@ -94,7 +94,7 @@ uint32_t pyVaultPlayerInfoNode::Player_GetPlayerID( void )
return 0; return 0;
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.playerId; return playerInfo.GetPlayerId();
} }
void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name ) void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name )
@ -114,11 +114,11 @@ const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void )
return ""; return "";
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.playerName) if (!playerInfo.GetPlayerName())
return ""; return "";
free(ansiPlayerName); free(ansiPlayerName);
ansiPlayerName = StrDupToAnsi(playerInfo.playerName); ansiPlayerName = StrDupToAnsi(playerInfo.GetPlayerName());
return ansiPlayerName; return ansiPlayerName;
} }
@ -129,7 +129,7 @@ void pyVaultPlayerInfoNode::Player_SetAgeInstanceName( const char * agename )
return; return;
wchar_t * wStr = StrDupToUnicode(agename); wchar_t * wStr = StrDupToUnicode(agename);
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetAgeInstName(wStr); playerInfo.SetAgeInstName(wStr);
free(wStr); free(wStr);
} }
@ -140,11 +140,11 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void )
return ""; return "";
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.ageInstName) if (!playerInfo.GetAgeInstName())
return ""; return "";
free(ansiAgeInstName); free(ansiAgeInstName);
ansiAgeInstName = StrDupToAnsi(playerInfo.ageInstName); ansiAgeInstName = StrDupToAnsi(playerInfo.GetAgeInstName());
return ansiAgeInstName; return ansiAgeInstName;
} }
@ -162,7 +162,7 @@ plUUID pyVaultPlayerInfoNode::Player_GetAgeGuid(void) const
{ {
if (fNode) { if (fNode) {
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.ageInstUuid; return playerInfo.GetAgeInstUuid();
} }
return kNilUuid; return kNilUuid;
} }
@ -183,7 +183,7 @@ bool pyVaultPlayerInfoNode::Player_IsOnline( void )
return false; return false;
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.online; return playerInfo.GetOnline();
} }
int pyVaultPlayerInfoNode::Player_GetCCRLevel( void ) int pyVaultPlayerInfoNode::Player_GetCCRLevel( void )
@ -192,5 +192,5 @@ int pyVaultPlayerInfoNode::Player_GetCCRLevel( void )
return 0; return 0;
VaultPlayerInfoNode playerInfo(fNode); VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.ccrLevel; return playerInfo.GetCCRLevel();
} }

14
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

@ -266,8 +266,8 @@ std::string pyVaultPlayerNode::GetPlayerName()
return ""; return "";
VaultPlayerNode player(fNode); VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH]; char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.playerName, arrsize(ansiStr)); StrToAnsi(ansiStr, player.GetPlayerName(), arrsize(ansiStr));
return ansiStr; return ansiStr;
} }
@ -282,8 +282,8 @@ std::string pyVaultPlayerNode::GetAvatarShapeName()
return ""; return "";
VaultPlayerNode player(fNode); VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH]; char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.avatarShapeName, arrsize(ansiStr)); StrToAnsi(ansiStr, player.GetAvatarShapeName(), arrsize(ansiStr));
return ansiStr; return ansiStr;
} }
@ -298,7 +298,7 @@ bool pyVaultPlayerNode::IsDisabled()
return false; return false;
VaultPlayerNode player(fNode); VaultPlayerNode player(fNode);
return player.disabled; return player.GetDisabled();
} }
void pyVaultPlayerNode::SetOnlineTime(uint32_t value) void pyVaultPlayerNode::SetOnlineTime(uint32_t value)
@ -312,7 +312,7 @@ uint32_t pyVaultPlayerNode::GetOnlineTime()
return 0; return 0;
VaultPlayerNode player(fNode); VaultPlayerNode player(fNode);
return player.onlineTime; return player.GetOnlineTime();
} }
void pyVaultPlayerNode::SetExplorer (bool b) { void pyVaultPlayerNode::SetExplorer (bool b) {
@ -328,5 +328,5 @@ bool pyVaultPlayerNode::IsExplorer () {
return false; return false;
VaultPlayerNode player(fNode); VaultPlayerNode player(fNode);
return player.explorer; return player.GetExplorer();
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp

@ -76,7 +76,7 @@ void pyVaultSDLNode::SetIdent( int v )
return; return;
VaultSDLNode sdl(fNode); VaultSDLNode sdl(fNode);
sdl.SetSdlIdent(v); sdl.SetSDLIdent(v);
} }
int pyVaultSDLNode::GetIdent() const int pyVaultSDLNode::GetIdent() const
@ -85,7 +85,7 @@ int pyVaultSDLNode::GetIdent() const
return 0; return 0;
VaultSDLNode sdl(fNode); VaultSDLNode sdl(fNode);
return sdl.sdlIdent; return sdl.GetSDLIdent();
} }
PyObject * pyVaultSDLNode::GetStateDataRecord() const PyObject * pyVaultSDLNode::GetStateDataRecord() const

24
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp

@ -101,9 +101,9 @@ std::string pyVaultTextNoteNode::Note_GetTitle( void )
char * aStr = nil; char * aStr = nil;
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
if (textNote.noteTitle) { if (textNote.GetNoteTitle()) {
std::string result; std::string result;
aStr = StrDupToAnsi(textNote.noteTitle); aStr = StrDupToAnsi(textNote.GetNoteTitle());
result = aStr; result = aStr;
free(aStr); free(aStr);
return result; return result;
@ -117,8 +117,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTitleW( void )
return L""; return L"";
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
if (textNote.noteTitle) if (textNote.GetNoteTitle())
return textNote.noteTitle; return textNote.GetNoteTitle();
return L""; return L"";
} }
@ -151,9 +151,9 @@ std::string pyVaultTextNoteNode::Note_GetText( void )
char * aStr = nil; char * aStr = nil;
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
if (textNote.noteText) { if (textNote.GetNoteText()) {
std::string result; std::string result;
aStr = StrDupToAnsi(textNote.noteText); aStr = StrDupToAnsi(textNote.GetNoteText());
result = aStr; result = aStr;
free(aStr); free(aStr);
return result; return result;
@ -167,8 +167,8 @@ std::wstring pyVaultTextNoteNode::Note_GetTextW( void )
return L""; return L"";
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
if (textNote.noteText) if (textNote.GetNoteText())
return textNote.noteText; return textNote.GetNoteText();
return L""; return L"";
} }
@ -185,9 +185,9 @@ int32_t pyVaultTextNoteNode::Note_GetType( void )
{ {
if (!fNode) if (!fNode)
return 0; return 0;
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
return textNote.noteType; return textNote.GetNoteType();
} }
void pyVaultTextNoteNode::Note_SetSubType( int32_t type ) void pyVaultTextNoteNode::Note_SetSubType( int32_t type )
@ -203,9 +203,9 @@ int32_t pyVaultTextNoteNode::Note_GetSubType( void )
{ {
if (!fNode) if (!fNode)
return 0; return 0;
VaultTextNoteNode textNote(fNode); VaultTextNoteNode textNote(fNode);
return textNote.noteSubType; return textNote.GetNoteSubType();
} }
PyObject * pyVaultTextNoteNode::GetDeviceInbox() const PyObject * pyVaultTextNoteNode::GetDeviceInbox() const

14
Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp

@ -269,10 +269,13 @@ void pfSecurePreloader::PreloadNextFile()
void pfSecurePreloader::Init() void pfSecurePreloader::Init()
{ {
RegisterAs(kSecurePreloader_KEY); if (!fInstance)
fInstance = new pfSecurePreloader;
fInstance->RegisterAs(kSecurePreloader_KEY);
// TODO: If we're going to support reconnects, then let's do it right. // TODO: If we're going to support reconnects, then let's do it right.
// Later... // Later...
//plgDispatch::Dispatch()->RegisterForExactType(plNetCommAuthConnectedMsg::Index(), GetKey()); //plgDispatch::Dispatch()->RegisterForExactType(plNetCommAuthConnectedMsg::Index(), fInstance->GetKey());
} }
void pfSecurePreloader::Start() void pfSecurePreloader::Start()
@ -431,10 +434,3 @@ void pfSecurePreloader::FilePreloaded(const wchar_t* file, hsStream* stream)
// Continue down the warpath // Continue down the warpath
PreloadNextFile(); PreloadNextFile();
} }
pfSecurePreloader* pfSecurePreloader::GetInstance()
{
if (!fInstance)
fInstance = new pfSecurePreloader;
return fInstance;
}

2
Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h

@ -90,7 +90,7 @@ public:
plOperationProgress* GetProgressBar() { return fProgress; } plOperationProgress* GetProgressBar() { return fProgress; }
static pfSecurePreloader* GetInstance(); static pfSecurePreloader* GetInstance() { return fInstance; }
static void SetInstance(pfSecurePreloader* instance) { fInstance = instance; } static void SetInstance(pfSecurePreloader* instance) { fInstance = instance; }
}; };

16
Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp

@ -79,7 +79,7 @@ static int IsTracked(const plKeyData* keyData)
{ {
if( mlfTrack && keyData ) if( mlfTrack && keyData )
{ {
if( keyData->GetUoid().GetObjectName() && !stricmp(keyData->GetUoid().GetObjectName(), keyNameToLookFor) if( !keyData->GetUoid().GetObjectName().CompareI(keyNameToLookFor)
&& (keyData->GetUoid().GetClassType() == CLASS_TO_TRACK) ) && (keyData->GetUoid().GetClassType() == CLASS_TO_TRACK) )
{ {
if( (kCloneID < 0) if( (kCloneID < 0)
@ -180,9 +180,12 @@ plKey &plKey::operator=( const plKey &rhs )
{ {
char msg[ 512 ]; char msg[ 512 ];
if (fKeyData == nil) if (fKeyData == nil)
sprintf( msg, "=: Key %s %s is being assigned to a nil key", keyNameToLookFor, CloneString(rhs.fKeyData) ); sprintf( msg, "=: Key %s %s is being assigned to a nil key",
keyNameToLookFor, CloneString(rhs.fKeyData) );
else else
sprintf( msg, "=: Key %s %s is being assigned to %s", keyNameToLookFor, CloneString(rhs.fKeyData), fKeyData->GetUoid().GetObjectName() ); sprintf( msg, "=: Key %s %s is being assigned to %s",
keyNameToLookFor, CloneString(rhs.fKeyData),
fKeyData->GetUoid().GetObjectName().c_str() );
//hsAssert( false, msg ); //hsAssert( false, msg );
hsStatusMessageF(msg); hsStatusMessageF(msg);
} }
@ -190,9 +193,12 @@ plKey &plKey::operator=( const plKey &rhs )
{ {
char msg[ 512 ]; char msg[ 512 ];
if (fKeyData == nil) if (fKeyData == nil)
sprintf( msg, "=: Nil key is being assigned to %s %s", keyNameToLookFor, CloneString(fKeyData) ); sprintf( msg, "=: Nil key is being assigned to %s %s",
keyNameToLookFor, CloneString(fKeyData) );
else else
sprintf( msg, "=: Key %s %s is being assigned to %s", fKeyData->GetUoid().GetObjectName(), CloneString(fKeyData), keyNameToLookFor ); sprintf( msg, "=: Key %s %s is being assigned to %s",
fKeyData->GetUoid().GetObjectName().c_str(),
CloneString(fKeyData), keyNameToLookFor );
//hsAssert( false, msg ); //hsAssert( false, msg );
hsStatusMessageF(msg); hsStatusMessageF(msg);
} }

597
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -90,7 +90,7 @@ static inline void IReadArray (T ** buf, unsigned * elems, uint8_t ** buffer, un
ASSERT(bytes % sizeof(T) == 0); ASSERT(bytes % sizeof(T) == 0);
*elems = bytes / sizeof(T); *elems = bytes / sizeof(T);
T * src = (T *)*buffer; T * src = (T *)*buffer;
delete *buf; free(*buf);
*buf = (T *)malloc(bytes); *buf = (T *)malloc(bytes);
memcpy(*buf, src, bytes); memcpy(*buf, src, bytes);
*buffer += bytes; *buffer += bytes;
@ -185,46 +185,6 @@ static inline void ICopyString (wchar_t ** plhs, const wchar_t rhs[]) {
*plhs = StrDup(L""); *plhs = StrDup(L"");
} }
//============================================================================
template <typename T>
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;
}
} using namespace pnNpCommon; } using namespace pnNpCommon;
@ -337,29 +297,20 @@ void NetGameRank::CopyFrom(const NetGameRank & fromRank) {
***/ ***/
//============================================================================ //============================================================================
static void DeallocNodeFields (NetVaultNode * node) { void NetVaultNode::DeallocNodeFields () {
for (uint64_t fieldFlag = 1; fieldFlag; fieldFlag <<= 1) { free(createAgeName);
if (fieldFlag > node->fieldFlags) free(string64_1);
break; free(string64_2);
free(string64_3);
#define DELFIELD(f, v) case (uint64_t)(NetVaultNode::f): delete node->v; node->v = nil; break free(string64_4);
switch (fieldFlag & node->fieldFlags) { free(string64_5);
DELFIELD(kCreateAgeName, createAgeName); free(string64_6);
DELFIELD(kString64_1, string64_1); free(istring64_1);
DELFIELD(kString64_2, string64_2); free(istring64_2);
DELFIELD(kString64_3, string64_3); free(text_1);
DELFIELD(kString64_4, string64_4); free(text_2);
DELFIELD(kString64_5, string64_5); free(blob_1);
DELFIELD(kString64_6, string64_6); free(blob_2);
DELFIELD(kIString64_1, istring64_1);
DELFIELD(kIString64_2, istring64_2);
DELFIELD(kText_1, text_1);
DELFIELD(kText_2, text_2);
DELFIELD(kBlob_1, blob_1);
DELFIELD(kBlob_2, blob_2);
default: break;
}
}
} }
//============================================================================ //============================================================================
@ -378,70 +329,59 @@ NetVaultNode::NetVaultNode ()
//============================================================================ //============================================================================
NetVaultNode::~NetVaultNode () { NetVaultNode::~NetVaultNode () {
DeallocNodeFields(this); DeallocNodeFields();
} }
//============================================================================ //============================================================================
unsigned NetVaultNode::Read_LCS (const uint8_t inbuffer[], unsigned bufsz, unsigned rwOpts) { unsigned NetVaultNode::Read_LCS (const uint8_t inbuffer[], unsigned bufsz, unsigned rwOpts) {
DeallocNodeFields(this); DeallocNodeFields();
uint8_t * buffer = const_cast<uint8_t *>(inbuffer); uint8_t * buffer = const_cast<uint8_t *>(inbuffer);
uint8_t * start = buffer; uint8_t * start = buffer;
IReadValue(&fieldFlags, &buffer, &bufsz); IReadValue(&fieldFlags, &buffer, &bufsz);
for (uint64_t bit = 1; bit; bit <<= 1) {
// if we've passed all fields on the node then bail #define READ(flag, func, varptr) if (flag & fieldFlags) func(varptr, &buffer, &bufsz);
if (bit > fieldFlags) #define READARR(flag, func, varptr, lenptr) if (flag & fieldFlags) func(varptr, lenptr, &buffer, &bufsz);
break; READ(kNodeId, IReadValue, &nodeId);
READ(kCreateTime, IReadValue, &createTime);
// if this field isn't in the set to be read, then continue to next READ(kModifyTime, IReadValue, &modifyTime);
if (!(bit & fieldFlags)) READ(kCreateAgeName,IReadString, &createAgeName);
continue; 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) if (rwOpts & kRwUpdateDirty)
dirtyFlags = fieldFlags; dirtyFlags = fieldFlags;
else else
@ -464,57 +404,46 @@ unsigned NetVaultNode::Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts) {
return 0; return 0;
IWriteValue(flags, buffer); IWriteValue(flags, buffer);
for (uint64_t bit = 1; bit; bit <<= 1) {
// if we've passed all fields on the node then bail #define WRITE(flag, func, var) if (flag & flags) func(var, buffer);
if (bit > flags) #define WRITEARR(flag, func, var, len) if (flag & flags) func(var, len, buffer);
break; WRITE(kNodeId, IWriteValue, nodeId );
WRITE(kCreateTime, IWriteValue, createTime );
// if this field isn't in the set to be written, then continue to next WRITE(kModifyTime, IWriteValue, modifyTime );
if (!(bit & flags)) WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" );
continue; WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid );
WRITE(kCreatorAcct, IWriteValue, creatorAcct );
#define WRITE(flag, func, var) case flag: func(var, buffer); break WRITE(kCreatorId, IWriteValue, creatorId );
#define WRITEARR(flag, func, var, len) case flag: func(var, len, buffer); break WRITE(kNodeType, IWriteValue, nodeType );
switch (bit) { WRITE(kInt32_1, IWriteValue, int32_1 );
WRITE(kNodeId, IWriteValue, nodeId ); WRITE(kInt32_2, IWriteValue, int32_2 );
WRITE(kCreateTime, IWriteValue, createTime ); WRITE(kInt32_3, IWriteValue, int32_3 );
WRITE(kModifyTime, IWriteValue, modifyTime ); WRITE(kInt32_4, IWriteValue, int32_4 );
WRITE(kCreateAgeName, IWriteString, createAgeName ? createAgeName : L"" ); WRITE(kUInt32_1, IWriteValue, uint32_1 );
WRITE(kCreateAgeUuid, IWriteValue, createAgeUuid ); WRITE(kUInt32_2, IWriteValue, uint32_2 );
WRITE(kCreatorAcct, IWriteValue, creatorAcct ); WRITE(kUInt32_3, IWriteValue, uint32_3 );
WRITE(kCreatorId, IWriteValue, creatorId ); WRITE(kUInt32_4, IWriteValue, uint32_4 );
WRITE(kNodeType, IWriteValue, nodeType ); WRITE(kUuid_1, IWriteValue, uuid_1 );
WRITE(kInt32_1, IWriteValue, int32_1 ); WRITE(kUuid_2, IWriteValue, uuid_2 );
WRITE(kInt32_2, IWriteValue, int32_2 ); WRITE(kUuid_3, IWriteValue, uuid_3 );
WRITE(kInt32_3, IWriteValue, int32_3 ); WRITE(kUuid_4, IWriteValue, uuid_4 );
WRITE(kInt32_4, IWriteValue, int32_4 ); WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" );
WRITE(kUInt32_1, IWriteValue, uint32_1 ); WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" );
WRITE(kUInt32_2, IWriteValue, uint32_2 ); WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" );
WRITE(kUInt32_3, IWriteValue, uint32_3 ); WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" );
WRITE(kUInt32_4, IWriteValue, uint32_4 ); WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" );
WRITE(kUuid_1, IWriteValue, uuid_1 ); WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" );
WRITE(kUuid_2, IWriteValue, uuid_2 ); WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" );
WRITE(kUuid_3, IWriteValue, uuid_3 ); WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" );
WRITE(kUuid_4, IWriteValue, uuid_4 ); WRITE(kText_1, IWriteString, text_1 ? text_1 : L"" );
WRITE(kString64_1, IWriteString, string64_1 ? string64_1 : L"" ); WRITE(kText_2, IWriteString, text_2 ? text_2 : L"" );
WRITE(kString64_2, IWriteString, string64_2 ? string64_2 : L"" ); WRITEARR(kBlob_1, IWriteArray, blob_1, blob_1Length);
WRITE(kString64_3, IWriteString, string64_3 ? string64_3 : L"" ); WRITEARR(kBlob_2, IWriteArray, blob_2, blob_2Length);
WRITE(kString64_4, IWriteString, string64_4 ? string64_4 : L"" ); #undef WRITEARR
WRITE(kString64_5, IWriteString, string64_5 ? string64_5 : L"" ); #undef WRITE
WRITE(kString64_6, IWriteString, string64_6 ? string64_6 : L"" );
WRITE(kIString64_1, IWriteString, istring64_1 ? istring64_1 : L"" ); if (flags & ~kAllValidFields)
WRITE(kIString64_2, IWriteString, istring64_2 ? istring64_2 : L"" ); FATAL("Invalid field flag(s) encountered");
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
}
if (rwOpts & kRwUpdateDirty) if (rwOpts & kRwUpdateDirty)
dirtyFlags = 0; dirtyFlags = 0;
@ -529,7 +458,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 has gone past all set fields on the other node without failing, return true
if (bit > other->fieldFlags) if (bit > other->fieldFlags)
return true; return true;
// if the other node does not have the field, then continue to next field // if the other node does not have the field, then continue to next field
if (!(bit & other->fieldFlags)) if (!(bit & other->fieldFlags))
continue; continue;
@ -537,7 +466,7 @@ bool NetVaultNode::Matches (const NetVaultNode * other) {
// if we don't have the field (but the other node does), then return false // if we don't have the field (but the other node does), then return false
if (!(bit & fieldFlags)) if (!(bit & fieldFlags))
return false; return false;
#define COMPARE(flag, func, var) case flag: if (!func(var, other->var)) return false; break #define COMPARE(flag, func, var) case flag: if (!func(var, other->var)) return false; break
switch (bit) { switch (bit) {
COMPARE(kNodeId, ICompareValue, nodeId); COMPARE(kNodeId, ICompareValue, nodeId);
@ -583,16 +512,16 @@ bool NetVaultNode::Matches (const NetVaultNode * other) {
void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
if (this == other) if (this == other)
return; return;
uint64_t origDirtyFlags = dirtyFlags; uint64_t origDirtyFlags = dirtyFlags;
for (uint64_t bit = 1; bit; bit <<= 1) { for (uint64_t bit = 1; bit; bit <<= 1) {
// we already have a value for this field... // we already have a value for this field...
if (bit & fieldFlags) { if (bit & fieldFlags) {
if (!(copyOpts & kCopyOverwrite)) if (!(copyOpts & kCopyOverwrite))
continue; // don't overwrite our field value continue; // don't overwrite our field value
} }
// other does not have a value for this field... // other does not have a value for this field...
if (!(bit & other->fieldFlags)) { if (!(bit & other->fieldFlags)) {
// clear our field? // clear our field?
@ -600,10 +529,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
continue; continue;
// clear our field. // clear our field.
if (bit & fieldFlags) { if (bit & fieldFlags) {
#define _ZERO(flag, func, var, z) case flag: func(bit, this, &var, z); break #define _ZERO(flag, func, var, z) case flag: func(bit, &var, z); break
#define _ZEROSTRING(flag, func, var, z) case flag: func(bit, this, &var, z, kMaxVaultNodeStringLength); 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, this, &var, z, (unsigned)-1); 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, this, &var, &varlen, nil, 0); break #define _ZEROARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, nil, 0); break
switch (bit) { switch (bit) {
_ZERO(kNodeId, IVaultNodeSetValue, nodeId, (unsigned)0); _ZERO(kNodeId, IVaultNodeSetValue, nodeId, (unsigned)0);
_ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0); _ZERO(kCreateTime, IVaultNodeSetValue, createTime, (unsigned)0);
@ -646,10 +575,10 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
} }
} }
#define COPY(flag, func, var) case flag: func(bit, this, &var, other->var); break #define COPY(flag, func, var) case flag: func(bit, &var, other->var); break
#define COPYSTRING(flag, func, var) case flag: func(bit, this, &var, other->var, kMaxVaultNodeStringLength); break #define COPYSTRING(flag, func, var) case flag: func(bit, &var, other->var, kMaxVaultNodeStringLength); break
#define COPYCLOB(flag, func, var) case flag: func(bit, this, &var, other->var, (unsigned)-1); 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, this, &var, &varlen, other->var, other->varlen); break #define COPYARR(flag, func, var, varlen) case flag: func(bit, &var, &varlen, other->var, other->varlen); break
switch (bit) { switch (bit) {
COPY(kNodeId, IVaultNodeSetValue, nodeId ); COPY(kNodeId, IVaultNodeSetValue, nodeId );
COPY(kCreateTime, IVaultNodeSetValue, createTime ); COPY(kCreateTime, IVaultNodeSetValue, createTime );
@ -697,408 +626,162 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) {
//============================================================================ //============================================================================
void NetVaultNode::SetNodeId (unsigned v) { void NetVaultNode::SetNodeId (unsigned v) {
IVaultNodeSetValue(kNodeId, this, &nodeId, v); IVaultNodeSetValue(kNodeId, &nodeId, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetCreateTime (unsigned v) { void NetVaultNode::SetCreateTime (unsigned v) {
IVaultNodeSetValue(kCreateTime, this, &createTime, v); IVaultNodeSetValue(kCreateTime, &createTime, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetModifyTime (unsigned v) { void NetVaultNode::SetModifyTime (unsigned v) {
IVaultNodeSetValue(kModifyTime, this, &modifyTime, v); IVaultNodeSetValue(kModifyTime, &modifyTime, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetCreateAgeName (const wchar_t 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) { void NetVaultNode::SetCreateAgeUuid (const plUUID& v) {
IVaultNodeSetValue(kCreateAgeUuid, this, &createAgeUuid, v); IVaultNodeSetValue(kCreateAgeUuid, &createAgeUuid, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetCreatorAcct (const plUUID& v) { void NetVaultNode::SetCreatorAcct (const plUUID& v) {
IVaultNodeSetValue(kCreatorAcct, this, &creatorAcct, v); IVaultNodeSetValue(kCreatorAcct, &creatorAcct, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetCreatorId (unsigned v) { void NetVaultNode::SetCreatorId (unsigned v) {
IVaultNodeSetValue(kCreatorId, this, &creatorId, v); IVaultNodeSetValue(kCreatorId, &creatorId, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetNodeType (unsigned v) { void NetVaultNode::SetNodeType (unsigned v) {
IVaultNodeSetValue(kNodeType, this, &nodeType, v); IVaultNodeSetValue(kNodeType, &nodeType, v);
} }
//============================================================================ //============================================================================
void NetVaultNode::SetInt32_1 (int 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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[]) { 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) { 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) { void NetVaultNode::SetBlob_2 (const uint8_t v[], unsigned len) {
IVaultNodeSetBlob(kBlob_2, this, &blob_2, &blob_2Length, v, len); IVaultNodeSetBlob(kBlob_2, &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<plUUID*>(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;
}
} }

355
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 kText_2 = (uint64_t)1<<29;
static const uint64_t kBlob_1 = (uint64_t)1<<30; static const uint64_t kBlob_1 = (uint64_t)1<<30;
static const uint64_t kBlob_2 = (uint64_t)1<<31; static const uint64_t kBlob_2 = (uint64_t)1<<31;
static const uint64_t kAllValidFields = 0x00000000FFFFFFFFULL;
CCritSect critsect; CCritSect critsect;
uint64_t fieldFlags;
uint64_t dirtyFlags;
plUUID revisionId; plUUID revisionId;
private:
uint64_t fieldFlags;
uint64_t dirtyFlags;
// Treat these as read-only or node flag fields will become invalid // Treat these as read-only or node flag fields will become invalid
// Threaded apps: Must be accessed with node->critsect locked // Threaded apps: Must be accessed with node->critsect locked
unsigned nodeId; uint32_t nodeId;
unsigned createTime; uint32_t createTime;
unsigned modifyTime; uint32_t modifyTime;
wchar_t * createAgeName; wchar_t * createAgeName;
plUUID createAgeUuid; plUUID createAgeUuid;
plUUID creatorAcct; // accountId of node creator plUUID creatorAcct; // accountId of node creator
unsigned creatorId; // playerId of node creator uint32_t creatorId; // playerId of node creator
unsigned nodeType; uint32_t nodeType;
int int32_1; int32_t int32_1;
int int32_2; int32_t int32_2;
int int32_3; int32_t int32_3;
int int32_4; int32_t int32_4;
unsigned uint32_1; uint32_t uint32_1;
unsigned uint32_2; uint32_t uint32_2;
unsigned uint32_3; uint32_t uint32_3;
unsigned uint32_4; uint32_t uint32_4;
plUUID uuid_1; plUUID uuid_1;
plUUID uuid_2; plUUID uuid_2;
plUUID uuid_3; plUUID uuid_3;
@ -245,40 +248,113 @@ struct NetVaultNode : AtomicRef {
wchar_t * istring64_2; wchar_t * istring64_2;
wchar_t * text_1; wchar_t * text_1;
wchar_t * text_2; wchar_t * text_2;
uint8_t * blob_1; uint32_t blob_1Length; uint8_t * blob_1; size_t blob_1Length;
uint8_t * blob_2; uint32_t blob_2Length; 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 <typename T>
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 ();
~NetVaultNode (); ~NetVaultNode ();
// Threaded apps: Must be called with node->critsect locked // 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 uint32_t Read_LCS (const uint8_t buffer[], size_t bufsz, uint32_t rwOpts); // returns number of bytes read
unsigned Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts); // returns number of bytes written uint32_t Write_LCS (ARRAY(uint8_t) * buffer, uint32_t rwOpts); // returns number of bytes written
bool Matches (const NetVaultNode * other); bool Matches (const NetVaultNode * other);
void CopyFrom (const NetVaultNode * other, unsigned copyOpts); void CopyFrom (const NetVaultNode * other, uint32_t copyOpts);
// Threaded apps: Must be called with node->critsect locked uint64_t GetFieldFlags () const { return fieldFlags; }
void SetNodeId (unsigned v); void ClearFieldFlags () { fieldFlags = 0; }
void SetCreateTime (unsigned v);
void SetModifyTime (unsigned v); 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 SetCreateAgeName (const wchar_t v[]);
void SetCreateAgeUuid (const plUUID& v); void SetCreateAgeUuid (const plUUID & v);
void SetCreatorAcct (const plUUID& v); void SetCreatorAcct (const plUUID & v);
void SetCreatorId (unsigned v); void SetCreatorId (uint32_t v);
void SetNodeType (unsigned v); void SetNodeType (uint32_t v);
void SetInt32_1 (int v); void SetInt32_1 (int32_t v);
void SetInt32_2 (int v); void SetInt32_2 (int32_t v);
void SetInt32_3 (int v); void SetInt32_3 (int32_t v);
void SetInt32_4 (int v); void SetInt32_4 (int32_t v);
void SetUInt32_1 (unsigned v); void SetUInt32_1 (uint32_t v);
void SetUInt32_2 (unsigned v); void SetUInt32_2 (uint32_t v);
void SetUInt32_3 (unsigned v); void SetUInt32_3 (uint32_t v);
void SetUInt32_4 (unsigned v); void SetUInt32_4 (uint32_t v);
void SetUuid_1 (const plUUID& v); void SetUuid_1 (const plUUID & v);
void SetUuid_2 (const plUUID& v); void SetUuid_2 (const plUUID & v);
void SetUuid_3 (const plUUID& v); void SetUuid_3 (const plUUID & v);
void SetUuid_4 (const plUUID& v); void SetUuid_4 (const plUUID & v);
void SetString64_1 (const wchar_t v[]); void SetString64_1 (const wchar_t v[]);
void SetString64_2 (const wchar_t v[]); void SetString64_2 (const wchar_t v[]);
void SetString64_3 (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 SetIString64_2 (const wchar_t v[]);
void SetText_1 (const wchar_t v[]); void SetText_1 (const wchar_t v[]);
void SetText_2 (const wchar_t v[]); void SetText_2 (const wchar_t v[]);
void SetBlob_1 (const uint8_t v[], unsigned len); void SetBlob_1 (const uint8_t v[], size_t len);
void SetBlob_2 (const uint8_t v[], unsigned len); void SetBlob_2 (const uint8_t v[], size_t len);
void SetText (uint64_t fieldFlag, const wchar_t v[]); uint32_t GetNodeId () const { return nodeId; }
void SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len); uint32_t GetCreateTime () const { return createTime; }
uint32_t GetModifyTime () const { return modifyTime; }
// These are only here to aid macro expansions (naming case matches field flags) const wchar_t * GetCreateAgeName () const { return createAgeName; }
inline unsigned GetNodeId () const { return nodeId; } plUUID GetCreateAgeUuid () const { return createAgeUuid; }
inline unsigned GetCreateTime () const { return createTime; } plUUID GetCreatorAcct () const { return creatorAcct; }
inline unsigned GetModifyTime () const { return modifyTime; } uint32_t GetCreatorId () const { return creatorId; }
inline wchar_t * GetCreateAgeName () const { return createAgeName; } uint32_t GetNodeType () const { return nodeType; }
inline plUUID GetCreateAgeUuid () const { return createAgeUuid; } int32_t GetInt32_1 () const { return int32_1; }
inline plUUID GetCreatorAcct () const { return creatorAcct; } int32_t GetInt32_2 () const { return int32_2; }
inline unsigned GetCreatorId () const { return creatorId; } int32_t GetInt32_3 () const { return int32_3; }
inline unsigned GetNodeType () const { return nodeType; } int32_t GetInt32_4 () const { return int32_4; }
inline int GetInt32_1 () const { return int32_1; } uint32_t GetUInt32_1 () const { return uint32_1; }
inline int GetInt32_2 () const { return int32_2; } uint32_t GetUInt32_2 () const { return uint32_2; }
inline int GetInt32_3 () const { return int32_3; } uint32_t GetUInt32_3 () const { return uint32_3; }
inline int GetInt32_4 () const { return int32_4; } uint32_t GetUInt32_4 () const { return uint32_4; }
inline unsigned GetUInt32_1 () const { return uint32_1; } plUUID GetUuid_1 () const { return uuid_1; }
inline unsigned GetUInt32_2 () const { return uint32_2; } plUUID GetUuid_2 () const { return uuid_2; }
inline unsigned GetUInt32_3 () const { return uint32_3; } plUUID GetUuid_3 () const { return uuid_3; }
inline unsigned GetUInt32_4 () const { return uint32_4; } plUUID GetUuid_4 () const { return uuid_4; }
inline plUUID GetUuid_1 () const { return uuid_1; } const wchar_t * GetString64_1 () const { return string64_1; }
inline plUUID GetUuid_2 () const { return uuid_2; } const wchar_t * GetString64_2 () const { return string64_2; }
inline plUUID GetUuid_3 () const { return uuid_3; } const wchar_t * GetString64_3 () const { return string64_3; }
inline plUUID GetUuid_4 () const { return uuid_4; } const wchar_t * GetString64_4 () const { return string64_4; }
inline wchar_t * GetString64_1 () const { return string64_1; } const wchar_t * GetString64_5 () const { return string64_5; }
inline wchar_t * GetString64_2 () const { return string64_2; } const wchar_t * GetString64_6 () const { return string64_6; }
inline wchar_t * GetString64_3 () const { return string64_3; } const wchar_t * GetIString64_1 () const { return istring64_1; }
inline wchar_t * GetString64_4 () const { return string64_4; } const wchar_t * GetIString64_2 () const { return istring64_2; }
inline wchar_t * GetString64_5 () const { return string64_5; } const wchar_t * GetText_1 () const { return text_1; }
inline wchar_t * GetString64_6 () const { return string64_6; } const wchar_t * GetText_2 () const { return text_2; }
inline wchar_t * GetIString64_1 () const { return istring64_1; } const uint8_t * GetBlob_1 () const { return blob_1; }
inline wchar_t * GetIString64_2 () const { return istring64_2; } size_t GetBlob_1Length () const { return blob_1Length; }
// no blob "getters" const uint8_t * GetBlob_2 () const { return blob_2; }
}; size_t GetBlob_2Length () const { return blob_2Length; }
//============================================================================
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 <typename T>
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);
}; };

34
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -816,9 +816,9 @@ void plClothingOutfit::ReadFromVault()
for (unsigned i = 0; i < nodes.Count(); ++i) { for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultSDLNode sdl(nodes[i]); VaultSDLNode sdl(nodes[i]);
if (sdl.sdlDataLen) { if (sdl.GetSDLDataLength()) {
hsRAMStream ram; hsRAMStream ram;
ram.Write(sdl.sdlDataLen, sdl.sdlData); ram.Write(sdl.GetSDLDataLength(), sdl.GetSDLData());
ram.Rewind(); ram.Rewind();
plString sdlRecName; plString sdlRecName;
@ -947,33 +947,33 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
node->DecRef(); // REF: Work node->DecRef(); // REF: Work
} }
} }
// Delete any leftover nodes // Delete any leftover nodes
{ for (unsigned i = 0; i < nodes.Count(); ++i) { for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultDeleteNode(nodes[i]->nodeId); VaultDeleteNode(nodes[i]->GetNodeId());
nodes[i]->DecRef(); // REF: Array nodes[i]->DecRef(); // REF: Array
}} }
// Create actual new nodes from their templates // 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; ENetError result;
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) { if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
actuals.Add(actual); actuals.Add(actual);
} }
templates[i]->DecRef(); // REF: Create templates[i]->DecRef(); // REF: Create
}} }
// Add new nodes to outfit folder // Add new nodes to outfit folder
{ for (unsigned i = 0; i < actuals.Count(); ++i) { for (unsigned i = 0; i < actuals.Count(); ++i) {
VaultAddChildNodeAndWait(rvn->nodeId, actuals[i]->nodeId, NetCommGetPlayer()->playerInt); VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt);
actuals[i]->DecRef(); // REF: Create actuals[i]->DecRef(); // REF: Create
}} }
// Cleanup morph SDRs // Cleanup morph SDRs
{for (unsigned i = 0; i < morphs.Count(); ++i) { for (unsigned i = 0; i < morphs.Count(); ++i) {
delete morphs[i]; delete morphs[i];
}} }
rvn->DecRef(); rvn->DecRef();
} }
@ -1585,8 +1585,8 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
ENetError result; ENetError result;
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) { if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
VaultAddChildNodeAndWait( VaultAddChildNodeAndWait(
rvn->nodeId, rvn->GetNodeId(),
actual->nodeId, actual->GetNodeId(),
NetCommGetPlayer()->playerInt NetCommGetPlayer()->playerInt
); );
actual->DecRef(); // REF: Create actual->DecRef(); // REF: Create

2
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -859,7 +859,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
else if (RelVaultNode * linkNode = VaultGetOwnedAgeLinkIncRef(&info)) { else if (RelVaultNode * linkNode = VaultGetOwnedAgeLinkIncRef(&info)) {
// We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one. // We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one.
VaultAgeLinkNode linkAcc(linkNode); VaultAgeLinkNode linkAcc(linkNode);
if (linkAcc.volat) { if (linkAcc.GetVolatile()) {
if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) { if (VaultUnregisterOwnedAgeAndWait(link.GetAgeInfo())) {
plUUID guid = plUUID::Generate(); plUUID guid = plUUID::Generate();
link.GetAgeInfo()->SetAgeInstanceGuid(&guid); link.GetAgeInfo()->SetAgeInstanceGuid(&guid);

21
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -279,6 +279,13 @@ plNetLinkingMgr::plNetLinkingMgr()
{ {
} }
plNetLinkingMgr::~plNetLinkingMgr()
{
std::for_each(s_opqueue.begin(), s_opqueue.end(),
[](NlmOp * op) { delete op; }
);
}
plNetLinkingMgr * plNetLinkingMgr::GetInstance() plNetLinkingMgr * plNetLinkingMgr::GetInstance()
{ {
static plNetLinkingMgr Instance; static plNetLinkingMgr Instance;
@ -788,10 +795,10 @@ void plNetLinkingMgr::IPostProcessLink( void )
RelVaultNode* info = VaultGetPlayerInfoNodeIncRef(); RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
if (fldr && info) if (fldr && info)
if (!fldr->IsParentOf(info->nodeId, 1)) if (!fldr->IsParentOf(info->GetNodeId(), 1))
VaultAddChildNode( VaultAddChildNode(
fldr->nodeId, fldr->GetNodeId(),
info->nodeId, info->GetNodeId(),
NetCommGetPlayer()->playerInt, NetCommGetPlayer()->playerInt,
nil, nil,
nil nil
@ -815,10 +822,10 @@ void plNetLinkingMgr::IPostProcessLink( void )
RelVaultNode* info = VaultGetPlayerInfoNodeIncRef(); RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
if (fldr && info) if (fldr && info)
if (!fldr->IsParentOf(info->nodeId, 1)) if (!fldr->IsParentOf(info->GetNodeId(), 1))
VaultAddChildNode( VaultAddChildNode(
fldr->nodeId, fldr->GetNodeId(),
info->nodeId, info->GetNodeId(),
NetCommGetPlayer()->playerInt, NetCommGetPlayer()->playerInt,
nil, nil,
nil nil
@ -974,7 +981,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
else if (RelVaultNode* linkNode = VaultGetOwnedAgeLinkIncRef(&ageInfo)) { else if (RelVaultNode* linkNode = VaultGetOwnedAgeLinkIncRef(&ageInfo)) {
// We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one. // We have the age in our AgesIOwnFolder. If its volatile, dump it for the new one.
VaultAgeLinkNode linkAcc(linkNode); VaultAgeLinkNode linkAcc(linkNode);
if (linkAcc.volat) { if (linkAcc.GetVolatile()) {
if (VaultUnregisterOwnedAgeAndWait(&ageInfo)) { if (VaultUnregisterOwnedAgeAndWait(&ageInfo)) {
// Fill in fields for new age create. // Fill in fields for new age create.
if (!info->HasAgeUserDefinedName()) if (!info->HasAgeUserDefinedName())

3
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h

@ -76,7 +76,8 @@ class plNetLinkingMgr
plNetLinkingMgr(); plNetLinkingMgr();
plNetLinkingMgr(const plNetLinkingMgr &); plNetLinkingMgr(const plNetLinkingMgr &) { }
~plNetLinkingMgr();
enum Cmds enum Cmds
{ {

2
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -785,7 +785,7 @@ void NetCommShutdown () {
if (!gDataServerLocal) if (!gDataServerLocal)
NetCliFileDisconnect(); NetCliFileDisconnect();
NetClientDestroy(false); NetClientDestroy();
AsyncCoreDestroy(30 * 1000); AsyncCoreDestroy(30 * 1000);
} }

19
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -1053,6 +1053,8 @@ struct ScoreGetScoresTrans : NetAuthTrans {
void * param void * param
); );
~ScoreGetScoresTrans();
bool Send (); bool Send ();
void Post (); void Post ();
bool Recv ( bool Recv (
@ -4649,6 +4651,11 @@ ScoreGetScoresTrans::ScoreGetScoresTrans (
StrCopy(m_gameName, gameName, arrsize(m_gameName)); StrCopy(m_gameName, gameName, arrsize(m_gameName));
} }
//============================================================================
ScoreGetScoresTrans::~ScoreGetScoresTrans () {
delete[] m_scores;
}
//============================================================================ //============================================================================
bool ScoreGetScoresTrans::Send () { bool ScoreGetScoresTrans::Send () {
if (!AcquireConn()) if (!AcquireConn())
@ -5613,10 +5620,10 @@ unsigned NetCliAuthVaultNodeSave (
FNetCliAuthVaultNodeSaveCallback callback, FNetCliAuthVaultNodeSaveCallback callback,
void * param 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 // Clear dirty bits of read-only fields before we write the node to the msg buffer
node->dirtyFlags &= ~( node->ClearDirtyFlags(
NetVaultNode::kNodeId | NetVaultNode::kNodeId |
NetVaultNode::kNodeType | NetVaultNode::kNodeType |
NetVaultNode::kCreatorAcct | NetVaultNode::kCreatorAcct |
@ -5624,15 +5631,15 @@ unsigned NetCliAuthVaultNodeSave (
NetVaultNode::kCreateTime NetVaultNode::kCreateTime
); );
if (!node->dirtyFlags) if (!node->GetDirtyFlags())
return 0; return 0;
if (!node->nodeId) if (!node->GetNodeId())
return 0; return 0;
// force sending of the nodeType value, since the auth needs it. // force sending of the nodeType value, since the auth needs it.
// auth will clear the field before sending it on to the vault. // 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 // We're definitely saving this node, so assign a revisionId
node->revisionId = plUUID::Generate(); node->revisionId = plUUID::Generate();
@ -5641,7 +5648,7 @@ unsigned NetCliAuthVaultNodeSave (
unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty); unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty);
VaultSaveNodeTrans * trans = new VaultSaveNodeTrans( VaultSaveNodeTrans * trans = new VaultSaveNodeTrans(
node->nodeId, node->GetNodeId(),
node->revisionId, node->revisionId,
buffer.Count(), buffer.Count(),
buffer.Ptr(), buffer.Ptr(),

1
Sources/Plasma/PubUtilLib/plPipeline/plBinkPlayer.h

@ -58,6 +58,7 @@ class plBinkPlayer
public: public:
plBinkPlayer() : fFileName(nil) { } plBinkPlayer() : fFileName(nil) { }
~plBinkPlayer() { delete [] fFileName; }
static bool Init( hsWindowHndl hWnd) { return true; } static bool Init( hsWindowHndl hWnd) { return true; }
static bool DeInit() { return true; } static bool DeInit() { return true; }

413
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

File diff suppressed because it is too large Load Diff

530
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -67,7 +67,7 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) {
unsigned index = 0; unsigned index = 0;
while (volatileFieldList[index].nodeType != 0) { while (volatileFieldList[index].nodeType != 0) {
if (node->nodeType == volatileFieldList[index].nodeType) { if (node->GetNodeType() == volatileFieldList[index].nodeType) {
volatileFields |= volatileFieldList[index].volatileFields; volatileFields |= volatileFieldList[index].volatileFields;
break; break;
} }
@ -78,204 +78,6 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node) {
return volatileFields; 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, &noteType, v);
}
//============================================================================
void VaultTextNoteNode::SetNoteSubType (int v) {
IVaultNodeSetValue(kNoteSubType, base, &noteSubType, v);
}
//============================================================================
void VaultTextNoteNode::SetNoteTitle (const wchar_t v[]) {
IVaultNodeSetString(kNoteTitle, base, &noteTitle, v, kMaxVaultNodeStringLength);
}
//============================================================================
void VaultTextNoteNode::SetNoteText (const wchar_t v[]) {
IVaultNodeSetString(kNoteText, base, &noteText, v, (unsigned)-1);
}
//============================================================================ //============================================================================
enum EAgeInfoFields { enum EAgeInfoFields {
kAgeFilename, kAgeFilename,
@ -415,7 +187,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
wchar_t * mem; wchar_t * mem;
const wchar_t * str = mem = StrDup(noteText); const wchar_t * str = mem = wcsdup(GetNoteText());
for (unsigned i = 0; i < kNumAgeInfoFields; ++i) { for (unsigned i = 0; i < kNumAgeInfoFields; ++i) {
@ -487,9 +259,9 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
break; break;
DEFAULT_FATAL(i); DEFAULT_FATAL(i);
} }
} }
free(mem); free(mem);
return true; return true;
} }
@ -501,42 +273,22 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) {
* VaultSDLNode * 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 #ifdef CLIENT
bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOptions) { bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOptions) {
if (!sdlDataLen || !sdlData) if (!GetSDLDataLength() || !GetSDLData())
return false; return false;
hsRAMStream ram; hsRAMStream ram;
ram.Write(sdlDataLen, sdlData); ram.Write(GetSDLDataLength(), GetSDLData());
ram.Rewind(); ram.Rewind();
plString sdlRecName; plString sdlRecName;
int sdlRecVersion; int sdlRecVersion;
if (!plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion)) if (!plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion))
return false; return false;
rec->SetDescriptor(sdlRecName, sdlRecVersion); rec->SetDescriptor(sdlRecName, sdlRecVersion);
// Note: Setting from default here results in a bug causing age SDL to // 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->WriteStreamHeader(&ram);
rec->Write(&ram, 0, writeOptions); rec->Write(&ram, 0, writeOptions);
ram.Rewind(); ram.Rewind();
unsigned bytes = ram.GetEOF(); unsigned bytes = ram.GetEOF();
uint8_t * buf = nil; uint8_t * buf = nil;
buf = (uint8_t *)malloc(bytes); buf = (uint8_t *)malloc(bytes);
ram.CopyToMem(buf); ram.CopyToMem(buf);
SetSDLData(buf, bytes);
IVaultNodeSetBlob(kSDLData, base, &sdlData, &sdlDataLen, buf, bytes);
free(buf); free(buf);
} }
#endif // def CLIENT #endif // def CLIENT
@ -585,7 +335,7 @@ void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned wri
if (exists) if (exists)
return; return;
} }
char aStr[MAX_PATH]; char aStr[MAX_PATH];
StrToAnsi(aStr, sdlRecName, arrsize(aStr)); StrToAnsi(aStr, sdlRecName, arrsize(aStr));
if (plStateDescriptor * des = plSDLMgr::GetInstance()->FindDescriptor(aStr, plSDL::kLatestVersion)) { 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 #ifdef CLIENT
void VaultImageNode::StuffImage (plMipmap * src, int dstType) { void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
@ -647,14 +372,14 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
} }
if (compressSuccess) { if (compressSuccess) {
unsigned bytes = ramStream.GetEOF(); unsigned bytes = ramStream.GetEOF();
uint8_t * buffer = (uint8_t *)malloc(bytes); uint8_t * buffer = (uint8_t *)malloc(bytes);
ramStream.CopyToMem(buffer); ramStream.CopyToMem(buffer);
IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes); SetImageData(buffer, bytes);
SetImageType(dstType); SetImageType(dstType);
free(buffer); free(buffer);
} else { } else {
IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, nil, 0); SetImageData(nil, 0);
SetImageType(kNone); SetImageType(kNone);
} }
} }
@ -664,10 +389,10 @@ void VaultImageNode::StuffImage (plMipmap * src, int dstType) {
#ifdef CLIENT #ifdef CLIENT
bool VaultImageNode::ExtractImage (plMipmap ** dst) { bool VaultImageNode::ExtractImage (plMipmap ** dst) {
hsRAMStream ramStream; hsRAMStream ramStream;
ramStream.Write(imgDataLen, imgData); ramStream.Write(GetImageDataLength(), GetImageData());
ramStream.Rewind(); ramStream.Rewind();
switch (imgType) { switch (GetImageType()) {
case kJPEG: case kJPEG:
(*dst) = plJPEG::Instance().ReadFromStream(&ramStream); (*dst) = plJPEG::Instance().ReadFromStream(&ramStream);
break; break;
@ -707,30 +432,10 @@ struct MatchesSpawnPointName
}; };
#endif #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 #ifdef CLIENT
bool VaultAgeLinkNode::CopyTo (plAgeLinkStruct * link) { 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)) { if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
VaultAgeInfoNode access(info); VaultAgeInfoNode access(info);
access.CopyTo(link->GetAgeInfo()); access.CopyTo(link->GetAgeInfo());
@ -801,7 +506,7 @@ bool VaultAgeLinkNode::HasSpawnPoint (const plSpawnPointInfo & point) const {
#ifdef CLIENT #ifdef CLIENT
void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const { void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const {
plString str = plString::FromUtf8(reinterpret_cast<const char*>(spawnPoints), spawnPointsLen); plString str = plString::FromUtf8(reinterpret_cast<const char*>(GetSpawnPoints()), GetSpawnPointsLength());
std::vector<plString> izer = str.Tokenize(";"); std::vector<plString> izer = str.Tokenize(";");
for (auto token1 = izer.begin(); token1 != izer.end(); ++token1) for (auto token1 = izer.begin(); token1 != izer.end(); ++token1)
{ {
@ -830,132 +535,17 @@ void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) {
<< in[i].fSpawnPt << ":" << in[i].fSpawnPt << ":"
<< in[i].fCameraStack << ";"; << in[i].fCameraStack << ";";
} }
IVaultNodeSetBlob( plString blob = ss.GetString();
kSpawnPoints, SetSpawnPoints(reinterpret_cast<const uint8_t *>(blob.c_str()), blob.GetSize());
base,
&spawnPoints,
&spawnPointsLen,
(const uint8_t *)ss.GetString().c_str(),
ss.GetLength()
);
} }
#endif #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::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 #ifdef CLIENT
const class plUnifiedTime * VaultAgeInfoNode::GetAgeTime () const { const class plUnifiedTime * VaultAgeInfoNode::GetAgeTime () const {
@ -978,13 +568,13 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
SetAgeFilename(nil); SetAgeFilename(nil);
} }
// age instance name // age instance name
if (info->HasAgeInstanceName()) { if (info->HasAgeInstanceName()) {
StrToUnicode(str, info->GetAgeInstanceName(), arrsize(str)); StrToUnicode(str, info->GetAgeInstanceName(), arrsize(str));
SetAgeInstName(str); SetAgeInstanceName(str);
} }
else { else {
SetAgeInstName(nil); SetAgeInstanceName(nil);
} }
// age user-defined name // age user-defined name
@ -1010,9 +600,9 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
SetAgeSequenceNumber(info->GetAgeSequenceNumber()); SetAgeSequenceNumber(info->GetAgeSequenceNumber());
// age instance guid // age instance guid
SetAgeInstGuid(*info->GetAgeInstanceGuid()); SetAgeInstanceGuid(*info->GetAgeInstanceGuid());
// age language // age language
SetAgeLanguage(info->GetAgeLanguage()); SetAgeLanguage(info->GetAgeLanguage());
} }
#endif // def CLIENT #endif // def CLIENT
@ -1022,73 +612,29 @@ void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) {
void VaultAgeInfoNode::CopyTo (plAgeInfoStruct * info) const { void VaultAgeInfoNode::CopyTo (plAgeInfoStruct * info) const {
char str[MAX_PATH]; char str[MAX_PATH];
// age filename // age filename
StrToAnsi(str, ageFilename, arrsize(str)); StrToAnsi(str, GetAgeFilename(), arrsize(str));
info->SetAgeFilename(str); info->SetAgeFilename(str);
// age instance name // age instance name
StrToAnsi(str, ageInstName, arrsize(str)); StrToAnsi(str, GetAgeInstanceName(), arrsize(str));
info->SetAgeInstanceName(str); info->SetAgeInstanceName(str);
// age user-defined name // age user-defined name
StrToAnsi(str, ageUserDefinedName, arrsize(str)); StrToAnsi(str, GetAgeUserDefinedName(), arrsize(str));
info->SetAgeUserDefinedName(str); info->SetAgeUserDefinedName(str);
// age description // age description
// TODO // TODO
// age sequence number // age sequence number
info->SetAgeSequenceNumber(ageSequenceNumber); info->SetAgeSequenceNumber(GetAgeSequenceNumber());
// age instance guid // age instance guid
plUUID uuid(ageInstUuid); plUUID uuid(GetAgeInstanceGuid());
info->SetAgeInstanceGuid(&uuid); info->SetAgeInstanceGuid(&uuid);
// age language // age language
info->SetAgeLanguage(ageLanguage); info->SetAgeLanguage(GetAgeLanguage());
} }
#endif // def CLIENT #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);
}

345
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h

@ -74,49 +74,38 @@ uint64_t GetNodeVolatileFields(NetVaultNode* node);
//============================================================================ //============================================================================
struct NetVaultNodeAccess { struct NetVaultNodeAccess {
NetVaultNode * base; NetVaultNode * base;
uint64_t & fieldFlags;
uint64_t & dirtyFlags;
NetVaultNodeAccess (NetVaultNode * node); NetVaultNodeAccess (NetVaultNode * node) : base(node) { }
NetVaultNodeAccess (const NetVaultNodeAccess &); // not implemented
const NetVaultNodeAccess & operator= (const NetVaultNodeAccess &); // not implemented 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 // VaultPlayerNode
//============================================================================ //============================================================================
struct VaultPlayerNode : NetVaultNodeAccess { struct VaultPlayerNode : NetVaultNodeAccess {
static const uint64_t kPlayerName = NetVaultNode::kIString64_1; VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1);
static const uint64_t kAvatarShapeName = NetVaultNode::kString64_1; VNODE_ACCESSOR(const wchar_t *, AvatarShapeName, String64_1);
static const uint64_t kDisabled = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, Disabled, Int32_1);
static const uint64_t kExplorer = NetVaultNode::kInt32_2; // explorer = 1, visitor = 0 VNODE_ACCESSOR(int32_t, Explorer, Int32_2); // explorer = 1, visitor = 0
static const uint64_t kOnlineTime = NetVaultNode::kUInt32_1; VNODE_ACCESSOR(uint32_t, OnlineTime, UInt32_1);
static const uint64_t kAccountUuid = NetVaultNode::kUuid_1; VNODE_ACCESSOR(plUUID, AccountUuid, Uuid_1);
static const uint64_t kInviteUuid = NetVaultNode::kUuid_2; VNODE_ACCESSOR(plUUID, InviteUuid, Uuid_2);
// Treat these as read-only or node flag fields will become invalid VaultPlayerNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
// 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);
}; };
@ -124,33 +113,14 @@ struct VaultPlayerNode : NetVaultNodeAccess {
// VaultPlayerInfoNode // VaultPlayerInfoNode
//============================================================================ //============================================================================
struct VaultPlayerInfoNode : NetVaultNodeAccess { struct VaultPlayerInfoNode : NetVaultNodeAccess {
static const uint64_t kPlayerId = NetVaultNode::kUInt32_1; VNODE_ACCESSOR(uint32_t, PlayerId, UInt32_1);
static const uint64_t kPlayerName = NetVaultNode::kIString64_1; VNODE_ACCESSOR(const wchar_t *, PlayerName, IString64_1);
static const uint64_t kAgeInstName = NetVaultNode::kString64_1; // name of age player is currently in VNODE_ACCESSOR(const wchar_t *, AgeInstName, String64_1); // name of age player is currently in
static const uint64_t kAgeInstUuid = NetVaultNode::kUuid_1; // guid of age player is currently in VNODE_ACCESSOR(plUUID, AgeInstUuid, Uuid_1); // guid of age player is currently in
static const uint64_t kOnline = NetVaultNode::kInt32_1; // whether or not player is online VNODE_ACCESSOR(int32_t, Online, Int32_1); // whether or not player is online
static const uint64_t kCCRLevel = NetVaultNode::kInt32_2; VNODE_ACCESSOR(int32_t, CCRLevel, Int32_2);
// Treat these as read-only or node flag fields will become invalid VaultPlayerInfoNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
// 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);
}; };
@ -158,21 +128,10 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess {
// VaultFolderNode // VaultFolderNode
//============================================================================ //============================================================================
struct VaultFolderNode : NetVaultNodeAccess { struct VaultFolderNode : NetVaultNodeAccess {
static const uint64_t kFolderType = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, FolderType, Int32_1);
static const uint64_t kFolderName = NetVaultNode::kString64_1; VNODE_ACCESSOR(const wchar_t *, FolderName, String64_1);
// Treat these as read-only or node flag fields will become invalid VaultFolderNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
// 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);
}; };
@ -180,44 +139,25 @@ struct VaultFolderNode : NetVaultNodeAccess {
// VaultPlayerInfoListNode // VaultPlayerInfoListNode
//============================================================================ //============================================================================
struct VaultPlayerInfoListNode : VaultFolderNode { struct VaultPlayerInfoListNode : VaultFolderNode {
VaultPlayerInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { }
VaultPlayerInfoListNode (NetVaultNode * node);
VaultPlayerInfoListNode (const VaultPlayerInfoListNode &); // not implemented
const VaultPlayerInfoListNode & operator= (const VaultPlayerInfoListNode &); // not implemented
}; };
//============================================================================ //============================================================================
// VaultAgeInfoListNode // VaultAgeInfoListNode
//============================================================================ //============================================================================
struct VaultAgeInfoListNode : VaultFolderNode { struct VaultAgeInfoListNode : VaultFolderNode {
VaultAgeInfoListNode (NetVaultNode * node) : VaultFolderNode(node) { }
VaultAgeInfoListNode (NetVaultNode * node);
VaultAgeInfoListNode (const VaultAgeInfoListNode &); // not implemented
const VaultAgeInfoListNode & operator= (const VaultAgeInfoListNode &); // not implemented
}; };
//============================================================================ //============================================================================
// VaultChronicleNode // VaultChronicleNode
//============================================================================ //============================================================================
struct VaultChronicleNode : NetVaultNodeAccess { struct VaultChronicleNode : NetVaultNodeAccess {
static const uint64_t kEntryType = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, EntryType, Int32_1);
static const uint64_t kEntryName = NetVaultNode::kString64_1; VNODE_ACCESSOR(const wchar_t *, EntryName, String64_1);
static const uint64_t kEntryValue = NetVaultNode::kText_1; VNODE_ACCESSOR(const wchar_t *, EntryValue, Text_1);
// Treat these as read-only or node flag fields will become invalid VaultChronicleNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
// 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[]);
}; };
@ -225,21 +165,11 @@ struct VaultChronicleNode : NetVaultNodeAccess {
// VaultSDLNode // VaultSDLNode
//============================================================================ //============================================================================
struct VaultSDLNode : NetVaultNodeAccess { struct VaultSDLNode : NetVaultNodeAccess {
static const uint64_t kSDLName = NetVaultNode::kString64_1; VNODE_ACCESSOR(const wchar_t *, SDLName, String64_1);
static const uint64_t kSDLIdent = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, SDLIdent, Int32_1);
static const uint64_t kSDLData = NetVaultNode::kBlob_1; VNODE_BLOB ( SDLData, Blob_1);
int & sdlIdent; VaultSDLNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
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[]);
#ifdef CLIENT #ifdef CLIENT
bool GetStateDataRecord (class plStateDataRecord * out, unsigned readOptions = 0); bool GetStateDataRecord (class plStateDataRecord * out, unsigned readOptions = 0);
@ -252,21 +182,11 @@ struct VaultSDLNode : NetVaultNodeAccess {
// VaultAgeLinkNode // VaultAgeLinkNode
//============================================================================ //============================================================================
struct VaultAgeLinkNode : NetVaultNodeAccess { struct VaultAgeLinkNode : NetVaultNodeAccess {
static const uint64_t kUnlocked = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, Unlocked, Int32_1);
static const uint64_t kVolatile = NetVaultNode::kInt32_2; VNODE_ACCESSOR(int32_t, Volatile, Int32_2);
static const uint64_t kSpawnPoints = NetVaultNode::kBlob_1; VNODE_BLOB ( SpawnPoints, Blob_1);
int & unlocked; VaultAgeLinkNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
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);
#ifdef CLIENT #ifdef CLIENT
bool CopyTo (plAgeLinkStruct * link); bool CopyTo (plAgeLinkStruct * link);
@ -283,26 +203,14 @@ struct VaultAgeLinkNode : NetVaultNodeAccess {
// VaultImageNode // VaultImageNode
//============================================================================ //============================================================================
struct VaultImageNode : NetVaultNodeAccess { struct VaultImageNode : NetVaultNodeAccess {
enum ImageTypes { kNone=0, kJPEG=1, kPNG=2 }; enum ImageTypes { kNone=0, kJPEG=1, kPNG=2 };
static const uint64_t kImageType = NetVaultNode::kInt32_1; VNODE_ACCESSOR(int32_t, ImageType, Int32_1);
static const uint64_t kImageTitle = NetVaultNode::kString64_1; VNODE_ACCESSOR(const wchar_t *, ImageTitle, String64_1);
static const uint64_t kImageData = NetVaultNode::kBlob_1; VNODE_BLOB ( ImageData, Blob_1);
wchar_t *& title; VaultImageNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
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);
#ifdef CLIENT #ifdef CLIENT
void StuffImage (class plMipmap * src, int dstType=kJPEG); void StuffImage (class plMipmap * src, int dstType=kJPEG);
bool ExtractImage (class plMipmap ** dst); bool ExtractImage (class plMipmap ** dst);
@ -316,9 +224,7 @@ struct VaultImageNode : NetVaultNodeAccess {
struct VaultCliImageNode : VaultImageNode { struct VaultCliImageNode : VaultImageNode {
class plMipmap * fMipmap; class plMipmap * fMipmap;
VaultCliImageNode (NetVaultNode * node); VaultCliImageNode (NetVaultNode * node) : VaultImageNode(node) { }
VaultCliImageNode (const VaultCliImageNode &); // not implemented
const VaultCliImageNode & operator= (const VaultCliImageNode &); // not implemented
}; };
#endif // def CLIENT #endif // def CLIENT
@ -326,27 +232,14 @@ struct VaultCliImageNode : VaultImageNode {
// VaultTextNoteNode // VaultTextNoteNode
//============================================================================ //============================================================================
struct VaultTextNoteNode : NetVaultNodeAccess { 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; #ifdef CLIENT
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
// for kNoteType_Visit/UnVisit // for kNoteType_Visit/UnVisit
void SetVisitInfo (const plAgeInfoStruct & info); void SetVisitInfo (const plAgeInfoStruct & info);
bool GetVisitInfo (plAgeInfoStruct * info); bool GetVisitInfo (plAgeInfoStruct * info);
@ -357,72 +250,34 @@ struct VaultTextNoteNode : NetVaultNodeAccess {
// VaultAgeNode // VaultAgeNode
//============================================================================ //============================================================================
struct VaultAgeNode : NetVaultNodeAccess { 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; VaultAgeNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
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[]);
}; };
//============================================================================ //============================================================================
// VaultAgeInfoNode // VaultAgeInfoNode
//============================================================================ //============================================================================
struct VaultAgeInfoNode : NetVaultNodeAccess { 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 #ifdef CLIENT
const class plUnifiedTime * GetAgeTime () const; const class plUnifiedTime * GetAgeTime () const;
void CopyFrom (const plAgeInfoStruct * info); void CopyFrom (const plAgeInfoStruct * info);
@ -434,16 +289,9 @@ struct VaultAgeInfoNode : NetVaultNodeAccess {
// VaultSystemNode // VaultSystemNode
//============================================================================ //============================================================================
struct VaultSystemNode : NetVaultNodeAccess { struct VaultSystemNode : NetVaultNodeAccess {
VNODE_ACCESSOR(int32_t, CCRStatus, Int32_1);
static const uint64_t kCCRStatus = NetVaultNode::kInt32_1; VaultSystemNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
int & ccrStatus;
VaultSystemNode (NetVaultNode * node);
VaultSystemNode (const VaultTextNoteNode &); // not implemented
const VaultSystemNode & operator= (const VaultSystemNode &); // not implemented
void SetCCRStatus (int v);
}; };
@ -451,17 +299,8 @@ struct VaultSystemNode : NetVaultNodeAccess {
// VaultMarkerGameNode // VaultMarkerGameNode
//============================================================================ //============================================================================
struct VaultMarkerGameNode : NetVaultNodeAccess { 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; VaultMarkerGameNode (NetVaultNode * node) : NetVaultNodeAccess(node) { }
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);
}; };

Loading…
Cancel
Save