Browse Source

Merge pull request #461 from cwalther/setpublic

Let ptVault.setAgePublic accept ptVaultAgeInfoNode in addition to ptAgeInfoStruct
Adam Johnson 10 years ago
parent
commit
b4206e54c9
  1. 5
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfPython/pyVault.h
  3. 16
      Sources/Plasma/FeatureLib/pfPython/pyVaultGlue.cpp
  4. 14
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  5. 1
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h

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

@ -641,6 +641,11 @@ bool pyVault::SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic )
return VaultSetOwnedAgePublicAndWait(ageInfo->GetAgeInfo(), makePublic); return VaultSetOwnedAgePublicAndWait(ageInfo->GetAgeInfo(), makePublic);
} }
bool pyVault::SetAgePublic( const pyVaultAgeInfoNode * ageInfoNode, bool makePublic )
{
return VaultSetAgePublicAndWait(ageInfoNode->GetNode(), makePublic);
}
PyObject* pyVault::GetGlobalInbox() PyObject* pyVault::GetGlobalInbox()
{ {

2
Sources/Plasma/FeatureLib/pfPython/pyVault.h

@ -174,6 +174,8 @@ public:
void CreateNeighborhood(); void CreateNeighborhood();
// set an age's public status. will fail if you aren't czar of age. // set an age's public status. will fail if you aren't czar of age.
bool SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic ); bool SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic );
// set an age's public status, also works for non-owners
bool SetAgePublic( const pyVaultAgeInfoNode * ageInfoNode, bool makePublic );
PyObject* GetGlobalInbox( void ); // returns pyVaultFolderNode PyObject* GetGlobalInbox( void ); // returns pyVaultFolderNode

16
Sources/Plasma/FeatureLib/pfPython/pyVaultGlue.cpp

@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyEnum.h" #include "pyEnum.h"
#include "pyAgeInfoStruct.h" #include "pyAgeInfoStruct.h"
#include "pyVaultNode.h" #include "pyVaultNode.h"
#include "pyVaultAgeInfoNode.h"
#include "pySDL.h" #include "pySDL.h"
#include "pyAgeLinkStruct.h" #include "pyAgeLinkStruct.h"
@ -455,17 +456,22 @@ PYTHON_METHOD_DEFINITION(ptVault, setAgePublic, args)
char makePublic; char makePublic;
if (!PyArg_ParseTuple(args, "Ob", &ageInfoObj, &makePublic)) if (!PyArg_ParseTuple(args, "Ob", &ageInfoObj, &makePublic))
{ {
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct and a boolean"); PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct or ptVaultAgeInfoNode and a boolean");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
if (!pyAgeInfoStruct::Check(ageInfoObj)) if (pyAgeInfoStruct::Check(ageInfoObj))
{ {
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct and a boolean");
PYTHON_RETURN_ERROR;
}
pyAgeInfoStruct* ageInfo = pyAgeInfoStruct::ConvertFrom(ageInfoObj); pyAgeInfoStruct* ageInfo = pyAgeInfoStruct::ConvertFrom(ageInfoObj);
PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfo, makePublic != 0)); PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfo, makePublic != 0));
} }
else if (pyVaultAgeInfoNode::Check(ageInfoObj))
{
pyVaultAgeInfoNode* ageInfoNode = pyVaultAgeInfoNode::ConvertFrom(ageInfoObj);
PYTHON_RETURN_BOOL(self->fThis->SetAgePublic(ageInfoNode, makePublic != 0));
}
PyErr_SetString(PyExc_TypeError, "setAgePublic expects a ptAgeInfoStruct or ptVaultAgeInfoNode and a boolean");
PYTHON_RETURN_ERROR;
}
PYTHON_START_METHODS_TABLE(ptVault) PYTHON_START_METHODS_TABLE(ptVault)
PYTHON_METHOD_NOARGS(ptVault, getPlayerInfo, "Returns a ptVaultNode of type kNodeTypePlayerInfo of the current player"), PYTHON_METHOD_NOARGS(ptVault, getPlayerInfo, "Returns a ptVaultNode of type kNodeTypePlayerInfo of the current player"),

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

@ -2477,9 +2477,17 @@ bool VaultAddOwnedAgeSpawnPoint (const plUUID& ageInstId, const plSpawnPointInfo
bool VaultSetOwnedAgePublicAndWait (const plAgeInfoStruct * info, bool publicOrNot) { bool VaultSetOwnedAgePublicAndWait (const plAgeInfoStruct * info, bool publicOrNot) {
if (hsRef<RelVaultNode> rvnLink = VaultGetOwnedAgeLink(info)) { if (hsRef<RelVaultNode> rvnLink = VaultGetOwnedAgeLink(info)) {
if (hsRef<RelVaultNode> rvnInfo = rvnLink->GetChildNode(plVault::kNodeType_AgeInfo, 1)) { if (hsRef<RelVaultNode> rvnInfo = rvnLink->GetChildNode(plVault::kNodeType_AgeInfo, 1)) {
NetCliAuthSetAgePublic(rvnInfo->GetNodeId(), publicOrNot); VaultSetAgePublicAndWait(rvnInfo, publicOrNot);
}
}
return true;
}
VaultAgeInfoNode access(rvnInfo); //============================================================================
bool VaultSetAgePublicAndWait (NetVaultNode * ageInfoNode, bool publicOrNot) {
NetCliAuthSetAgePublic(ageInfoNode->GetNodeId(), publicOrNot);
VaultAgeInfoNode access(ageInfoNode);
char ageName[MAX_PATH]; char ageName[MAX_PATH];
StrToAnsi(ageName, access.GetAgeFilename(), arrsize(ageName)); StrToAnsi(ageName, access.GetAgeFilename(), arrsize(ageName));
@ -2491,8 +2499,6 @@ bool VaultSetOwnedAgePublicAndWait (const plAgeInfoStruct * info, bool publicOrN
msg->SetResultCode(true); msg->SetResultCode(true);
msg->GetArgs()->AddString(plNetCommon::VaultTaskArgs::kAgeFilename, ageName); msg->GetArgs()->AddString(plNetCommon::VaultTaskArgs::kAgeFilename, ageName);
msg->Send(); msg->Send();
}
}
return true; return true;
} }

1
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h

@ -345,6 +345,7 @@ hsRef<RelVaultNode> VaultGetOwnedAgeInfo(const plAgeInfoStruct * info);
bool VaultGetOwnedAgeLink(const plAgeInfoStruct * info, plAgeLinkStruct * link); bool VaultGetOwnedAgeLink(const plAgeInfoStruct * info, plAgeLinkStruct * link);
bool VaultAddOwnedAgeSpawnPoint(const plUUID& ageInstId, const plSpawnPointInfo & spawnPt); bool VaultAddOwnedAgeSpawnPoint(const plUUID& ageInstId, const plSpawnPointInfo & spawnPt);
bool VaultSetOwnedAgePublicAndWait(const plAgeInfoStruct * info, bool publicOrNot); bool VaultSetOwnedAgePublicAndWait(const plAgeInfoStruct * info, bool publicOrNot);
bool VaultSetAgePublicAndWait(NetVaultNode * ageInfoNode, bool publicOrNot);
hsRef<RelVaultNode> VaultGetVisitAgeLink(const plAgeInfoStruct * info); hsRef<RelVaultNode> VaultGetVisitAgeLink(const plAgeInfoStruct * info);
bool VaultGetVisitAgeLink(const plAgeInfoStruct * info, class plAgeLinkStruct * link); bool VaultGetVisitAgeLink(const plAgeInfoStruct * info, class plAgeLinkStruct * link);
bool VaultRegisterOwnedAgeAndWait(const plAgeLinkStruct * link); bool VaultRegisterOwnedAgeAndWait(const plAgeLinkStruct * link);

Loading…
Cancel
Save