mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Use hsRef for storage of the remaining vault nodes
This commit is contained in:
@ -554,14 +554,12 @@ void _InvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode
|
|||||||
|
|
||||||
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID )
|
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID )
|
||||||
{
|
{
|
||||||
NetVaultNode * templateNode = new NetVaultNode;
|
hsRef<NetVaultNode> templateNode = new NetVaultNode;
|
||||||
templateNode->Ref();
|
|
||||||
templateNode->SetNodeType(plVault::kNodeType_TextNote);
|
templateNode->SetNodeType(plVault::kNodeType_TextNote);
|
||||||
VaultTextNoteNode visitAcc(templateNode);
|
VaultTextNoteNode visitAcc(templateNode);
|
||||||
visitAcc.SetNoteType(plVault::kNoteType_Visit);
|
visitAcc.SetNoteType(plVault::kNoteType_Visit);
|
||||||
visitAcc.SetVisitInfo(*link.GetAgeLink()->GetAgeInfo());
|
visitAcc.SetVisitInfo(*link.GetAgeLink()->GetAgeInfo());
|
||||||
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, (void*)playerID);
|
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, (void*)playerID);
|
||||||
templateNode->UnRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -111,11 +111,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeInfoListNode, pyVaultFolderNode, "Params: n=
|
|||||||
PyObject *pyVaultAgeInfoListNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultAgeInfoListNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultAgeInfoListNode *newObj = (ptVaultAgeInfoListNode*)ptVaultAgeInfoListNode_type.tp_new(&ptVaultAgeInfoListNode_type, NULL, NULL);
|
ptVaultAgeInfoListNode *newObj = (ptVaultAgeInfoListNode*)ptVaultAgeInfoListNode_type.tp_new(&ptVaultAgeInfoListNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,11 +287,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeInfoNode, pyVaultNode, "Params: n=0\nPlasma
|
|||||||
PyObject *pyVaultAgeInfoNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultAgeInfoNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultAgeInfoNode *newObj = (ptVaultAgeInfoNode*)ptVaultAgeInfoNode_type.tp_new(&ptVaultAgeInfoNode_type, NULL, NULL);
|
ptVaultAgeInfoNode *newObj = (ptVaultAgeInfoNode*)ptVaultAgeInfoNode_type.tp_new(&ptVaultAgeInfoNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,11 +200,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeLinkNode, pyVaultNode, "Params: n=0\nPlasma
|
|||||||
PyObject *pyVaultAgeLinkNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultAgeLinkNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultAgeLinkNode *newObj = (ptVaultAgeLinkNode*)ptVaultAgeLinkNode_type.tp_new(&ptVaultAgeLinkNode_type, NULL, NULL);
|
ptVaultAgeLinkNode *newObj = (ptVaultAgeLinkNode*)ptVaultAgeLinkNode_type.tp_new(&ptVaultAgeLinkNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,11 +190,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultChronicleNode, pyVaultNode, "Params: n=0\nPlasm
|
|||||||
PyObject *pyVaultChronicleNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultChronicleNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultChronicleNode *newObj = (ptVaultChronicleNode*)ptVaultChronicleNode_type.tp_new(&ptVaultChronicleNode_type, NULL, NULL);
|
ptVaultChronicleNode *newObj = (ptVaultChronicleNode*)ptVaultChronicleNode_type.tp_new(&ptVaultChronicleNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +191,7 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultFolderNode, pyVaultFolderNode);
|
|||||||
PyObject *pyVaultFolderNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultFolderNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultFolderNode *newObj = (ptVaultFolderNode*)ptVaultFolderNode_type.tp_new(&ptVaultFolderNode_type, NULL, NULL);
|
ptVaultFolderNode *newObj = (ptVaultFolderNode*)ptVaultFolderNode_type.tp_new(&ptVaultFolderNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,11 +219,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultImageNode, pyVaultNode, "Params: n=0\nPlasma va
|
|||||||
PyObject *pyVaultImageNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultImageNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultImageNode *newObj = (ptVaultImageNode*)ptVaultImageNode_type.tp_new(&ptVaultImageNode_type, NULL, NULL);
|
ptVaultImageNode *newObj = (ptVaultImageNode*)ptVaultImageNode_type.tp_new(&ptVaultImageNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +114,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultMarkerGameNode, pyVaultNode, "Params: n=0\nPlas
|
|||||||
PyObject *pyVaultMarkerGameNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultMarkerGameNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultMarkerGameNode *newObj = (ptVaultMarkerGameNode*)ptVaultMarkerGameNode_type.tp_new(&ptVaultMarkerGameNode_type, NULL, NULL);
|
ptVaultMarkerGameNode *newObj = (ptVaultMarkerGameNode*)ptVaultMarkerGameNode_type.tp_new(&ptVaultMarkerGameNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ static void CDECL LogDumpProc (
|
|||||||
|
|
||||||
pyVaultNode::pyVaultNodeOperationCallback::pyVaultNodeOperationCallback(PyObject * cbObject)
|
pyVaultNode::pyVaultNodeOperationCallback::pyVaultNodeOperationCallback(PyObject * cbObject)
|
||||||
: fCbObject( cbObject )
|
: fCbObject( cbObject )
|
||||||
, fNode(nil)
|
|
||||||
, fPyNodeRef(nil)
|
, fPyNodeRef(nil)
|
||||||
, fContext(0)
|
, fContext(0)
|
||||||
{
|
{
|
||||||
@ -158,21 +157,16 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) {
|
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) {
|
||||||
if (rvn)
|
fNode = rvn;
|
||||||
rvn->Ref();
|
|
||||||
SWAP(rvn, fNode);
|
|
||||||
if (rvn)
|
|
||||||
rvn->UnRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () {
|
hsRef<RelVaultNode> pyVaultNode::pyVaultNodeOperationCallback::GetNode() const {
|
||||||
return fNode;
|
return fNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only for python glue, do NOT call
|
// only for python glue, do NOT call
|
||||||
pyVaultNode::pyVaultNode()
|
pyVaultNode::pyVaultNode()
|
||||||
: fNode(nil)
|
: fCreateAgeName(nil)
|
||||||
, fCreateAgeName(nil)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,19 +175,15 @@ pyVaultNode::pyVaultNode( RelVaultNode* nfsNode )
|
|||||||
: fNode(nfsNode)
|
: fNode(nfsNode)
|
||||||
, fCreateAgeName(nil)
|
, fCreateAgeName(nil)
|
||||||
{
|
{
|
||||||
if (fNode)
|
|
||||||
fNode->Ref("pyVaultNode");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pyVaultNode::~pyVaultNode()
|
pyVaultNode::~pyVaultNode()
|
||||||
{
|
{
|
||||||
if (fNode)
|
|
||||||
fNode->UnRef("pyVaultNode");
|
|
||||||
free(fCreateAgeName);
|
free(fCreateAgeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RelVaultNode* pyVaultNode::GetNode() const
|
hsRef<RelVaultNode> pyVaultNode::GetNode() const
|
||||||
{
|
{
|
||||||
return fNode;
|
return fNode;
|
||||||
}
|
}
|
||||||
@ -202,8 +192,8 @@ RelVaultNode* pyVaultNode::GetNode() const
|
|||||||
// override the equals to operator
|
// override the equals to operator
|
||||||
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
|
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
|
||||||
{
|
{
|
||||||
RelVaultNode* ours = GetNode();
|
hsRef<RelVaultNode> ours = GetNode();
|
||||||
RelVaultNode* theirs = vaultNode.GetNode();
|
hsRef<RelVaultNode> theirs = vaultNode.GetNode();
|
||||||
if (ours == nil && theirs == nil)
|
if (ours == nil && theirs == nil)
|
||||||
return true;
|
return true;
|
||||||
if (ours == nil || theirs == nil)
|
if (ours == nil || theirs == nil)
|
||||||
@ -418,14 +408,10 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
|
|||||||
&result
|
&result
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newNode) {
|
if (newNode)
|
||||||
newNode->Ref();
|
|
||||||
pynode->fNode->UnRef();
|
|
||||||
pynode->fNode = newNode;
|
pynode->fNode = newNode;
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
hsResult = hsFail;
|
hsResult = hsFail;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode);
|
PyObject* nodeRef = cb->fPyNodeRef = pyVaultNodeRef::New(fNode, pynode->fNode);
|
||||||
@ -530,11 +516,8 @@ void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext)
|
|||||||
// 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->GetNodeId() && fNode->GetNodeType()) {
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
|
||||||
ENetError result;
|
ENetError result;
|
||||||
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
|
||||||
node->Ref();
|
|
||||||
fNode->UnRef();
|
|
||||||
fNode = node;
|
fNode = node;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pyVaultNodeOperationCallback * cb = new pyVaultNodeOperationCallback( cbObject );
|
pyVaultNodeOperationCallback * cb = new pyVaultNodeOperationCallback( cbObject );
|
||||||
cb->SetNode(fNode);
|
cb->SetNode(fNode);
|
||||||
@ -555,11 +538,8 @@ void pyVaultNode::ForceSave()
|
|||||||
{
|
{
|
||||||
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
|
||||||
ENetError result;
|
ENetError result;
|
||||||
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
|
||||||
node->Ref();
|
|
||||||
fNode->UnRef();
|
|
||||||
fNode = node;
|
fNode = node;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VaultForceSaveNodeAndWait(fNode);
|
VaultForceSaveNodeAndWait(fNode);
|
||||||
@ -575,11 +555,8 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t
|
|||||||
// 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->GetNodeId() && fNode->GetNodeType()) {
|
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
|
||||||
ENetError result;
|
ENetError result;
|
||||||
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
|
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
|
||||||
node->Ref();
|
|
||||||
fNode->UnRef();
|
|
||||||
fNode = node;
|
fNode = node;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack the callbacks until vault notification is in place
|
// Hack the callbacks until vault notification is in place
|
||||||
|
@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "HeadSpin.h"
|
#include "HeadSpin.h"
|
||||||
#include "pyGlueHelpers.h"
|
#include "pyGlueHelpers.h"
|
||||||
|
#include "hsRefCnt.h"
|
||||||
|
|
||||||
struct RelVaultNode;
|
struct RelVaultNode;
|
||||||
class plMipmap;
|
class plMipmap;
|
||||||
@ -82,7 +83,7 @@ public:
|
|||||||
struct pyVaultNodeOperationCallback
|
struct pyVaultNodeOperationCallback
|
||||||
{
|
{
|
||||||
PyObject * fCbObject;
|
PyObject * fCbObject;
|
||||||
RelVaultNode * fNode;
|
hsRef<RelVaultNode> fNode;
|
||||||
PyObject * fPyNodeRef;
|
PyObject * fPyNodeRef;
|
||||||
uint32_t fContext;
|
uint32_t fContext;
|
||||||
|
|
||||||
@ -94,10 +95,10 @@ public:
|
|||||||
void VaultOperationComplete(int resultCode) { VaultOperationComplete(fContext, resultCode); }
|
void VaultOperationComplete(int resultCode) { VaultOperationComplete(fContext, resultCode); }
|
||||||
|
|
||||||
void SetNode (RelVaultNode * rvn);
|
void SetNode (RelVaultNode * rvn);
|
||||||
RelVaultNode * GetNode ();
|
hsRef<RelVaultNode> GetNode() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
RelVaultNode * fNode;
|
hsRef<RelVaultNode> fNode;
|
||||||
mutable char * fCreateAgeName;
|
mutable char * fCreateAgeName;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -118,7 +119,7 @@ public:
|
|||||||
|
|
||||||
static void AddPlasmaClasses(PyObject *m);
|
static void AddPlasmaClasses(PyObject *m);
|
||||||
|
|
||||||
RelVaultNode * GetNode() const;
|
hsRef<RelVaultNode> GetNode() const;
|
||||||
|
|
||||||
// override the equals to operator
|
// override the equals to operator
|
||||||
bool operator==(const pyVaultNode &vaultNode) const;
|
bool operator==(const pyVaultNode &vaultNode) const;
|
||||||
|
@ -541,11 +541,7 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultNode, pyVaultNode);
|
|||||||
PyObject *pyVaultNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultNode *newObj = (ptVaultNode*)ptVaultNode_type.tp_new(&ptVaultNode_type, NULL, NULL);
|
ptVaultNode *newObj = (ptVaultNode*)ptVaultNode_type.tp_new(&ptVaultNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,22 +65,20 @@ pyVaultNodeRef::pyVaultNodeRef(RelVaultNode * parent, RelVaultNode * child)
|
|||||||
: fParent(parent)
|
: fParent(parent)
|
||||||
, fChild(child)
|
, fChild(child)
|
||||||
{
|
{
|
||||||
fParent->Ref();
|
|
||||||
fChild->Ref();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pyVaultNodeRef::pyVaultNodeRef(int)
|
pyVaultNodeRef::pyVaultNodeRef(int)
|
||||||
: fParent(nil)
|
|
||||||
, fChild(nil)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pyVaultNodeRef::~pyVaultNodeRef()
|
hsRef<RelVaultNode> pyVaultNodeRef::GetParentNode() const
|
||||||
{
|
{
|
||||||
if (fParent)
|
return fParent;
|
||||||
fParent->UnRef();
|
}
|
||||||
if (fChild)
|
|
||||||
fChild->UnRef();
|
hsRef<RelVaultNode> pyVaultNodeRef::GetChildNode() const
|
||||||
|
{
|
||||||
|
return fChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,13 +50,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "HeadSpin.h"
|
#include "HeadSpin.h"
|
||||||
#include "pyGlueHelpers.h"
|
#include "pyGlueHelpers.h"
|
||||||
|
#include "hsRefCnt.h"
|
||||||
|
|
||||||
struct RelVaultNode;
|
struct RelVaultNode;
|
||||||
|
|
||||||
class pyVaultNodeRef
|
class pyVaultNodeRef
|
||||||
{
|
{
|
||||||
RelVaultNode * fParent;
|
hsRef<RelVaultNode> fParent;
|
||||||
RelVaultNode * fChild;
|
hsRef<RelVaultNode> fChild;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// should only be created from C++ side
|
// should only be created from C++ side
|
||||||
@ -64,10 +65,8 @@ protected:
|
|||||||
pyVaultNodeRef(int =0 );
|
pyVaultNodeRef(int =0 );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~pyVaultNodeRef();
|
hsRef<RelVaultNode> GetParentNode() const;
|
||||||
|
hsRef<RelVaultNode> GetChildNode() const;
|
||||||
RelVaultNode * GetParentNode () const { return fParent; }
|
|
||||||
RelVaultNode * GetChildNode () const { return fChild; }
|
|
||||||
|
|
||||||
// required functions for PyObject interoperability
|
// required functions for PyObject interoperability
|
||||||
PYTHON_EXPOSE_TYPE; // so we can subclass
|
PYTHON_EXPOSE_TYPE; // so we can subclass
|
||||||
|
@ -125,16 +125,8 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultNodeRef, pyVaultNodeRef);
|
|||||||
PyObject *pyVaultNodeRef::New(RelVaultNode * parent, RelVaultNode * child)
|
PyObject *pyVaultNodeRef::New(RelVaultNode * parent, RelVaultNode * child)
|
||||||
{
|
{
|
||||||
ptVaultNodeRef *newObj = (ptVaultNodeRef*)ptVaultNodeRef_type.tp_new(&ptVaultNodeRef_type, NULL, NULL);
|
ptVaultNodeRef *newObj = (ptVaultNodeRef*)ptVaultNodeRef_type.tp_new(&ptVaultNodeRef_type, NULL, NULL);
|
||||||
if (newObj->fThis->fParent)
|
|
||||||
newObj->fThis->fParent->UnRef();
|
|
||||||
if (newObj->fThis->fChild)
|
|
||||||
newObj->fThis->fChild->UnRef();
|
|
||||||
newObj->fThis->fParent = parent;
|
newObj->fThis->fParent = parent;
|
||||||
newObj->fThis->fChild = child;
|
newObj->fThis->fChild = child;
|
||||||
if (newObj->fThis->fParent)
|
|
||||||
newObj->fThis->fParent->Ref();
|
|
||||||
if (newObj->fThis->fChild)
|
|
||||||
newObj->fThis->fChild->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,9 @@ bool pyVaultPlayerInfoListNode::HasPlayer( uint32_t playerID )
|
|||||||
|
|
||||||
static void IAddPlayer_NodesFound(ENetError result, void* param, unsigned nodeIdCount, const unsigned nodeIds[])
|
static void IAddPlayer_NodesFound(ENetError result, void* param, unsigned nodeIdCount, const unsigned nodeIds[])
|
||||||
{
|
{
|
||||||
NetVaultNode* parent = static_cast<NetVaultNode*>(param);
|
hsRef<NetVaultNode> parent = static_cast<NetVaultNode*>(param);
|
||||||
if (nodeIdCount)
|
if (nodeIdCount)
|
||||||
VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
|
VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
|
||||||
parent->UnRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
|
void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
|
||||||
@ -104,8 +103,7 @@ void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
|
|||||||
if (HasPlayer(playerID) || !fNode)
|
if (HasPlayer(playerID) || !fNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NetVaultNode* templateNode = new NetVaultNode();
|
hsRef<NetVaultNode> templateNode = new NetVaultNode();
|
||||||
templateNode->Ref();
|
|
||||||
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
|
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
|
||||||
VaultPlayerInfoNode access(templateNode);
|
VaultPlayerInfoNode access(templateNode);
|
||||||
access.SetPlayerId(playerID);
|
access.SetPlayerId(playerID);
|
||||||
@ -116,10 +114,8 @@ void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
|
|||||||
// So, if we know about this node, we can take it easy. If not, we lazy load it.
|
// So, if we know about this node, we can take it easy. If not, we lazy load it.
|
||||||
if (nodeIds.Count())
|
if (nodeIds.Count())
|
||||||
VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
|
VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
|
||||||
else {
|
else
|
||||||
fNode->Ref();
|
|
||||||
VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode);
|
VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )
|
void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )
|
||||||
|
@ -179,11 +179,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultPlayerInfoListNode, pyVaultFolderNode, "Params:
|
|||||||
PyObject *pyVaultPlayerInfoListNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultPlayerInfoListNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultPlayerInfoListNode *newObj = (ptVaultPlayerInfoListNode*)ptVaultPlayerInfoListNode_type.tp_new(&ptVaultPlayerInfoListNode_type, NULL, NULL);
|
ptVaultPlayerInfoListNode *newObj = (ptVaultPlayerInfoListNode*)ptVaultPlayerInfoListNode_type.tp_new(&ptVaultPlayerInfoListNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,11 +171,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultPlayerInfoNode, pyVaultPlayerInfoNode)
|
|||||||
PyObject *pyVaultPlayerInfoNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultPlayerInfoNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultPlayerInfoNode *newObj = (ptVaultPlayerInfoNode*)ptVaultPlayerInfoNode_type.tp_new(&ptVaultPlayerInfoNode_type, NULL, NULL);
|
ptVaultPlayerInfoNode *newObj = (ptVaultPlayerInfoNode*)ptVaultPlayerInfoNode_type.tp_new(&ptVaultPlayerInfoNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,11 +321,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultPlayerNode, pyVaultPlayerNode)
|
|||||||
PyObject *pyVaultPlayerNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultPlayerNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultPlayerNode *newObj = (ptVaultPlayerNode*)ptVaultPlayerNode_type.tp_new(&ptVaultPlayerNode_type, NULL, NULL);
|
ptVaultPlayerNode *newObj = (ptVaultPlayerNode*)ptVaultPlayerNode_type.tp_new(&ptVaultPlayerNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,11 +129,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultSDLNode, pyVaultSDLNode)
|
|||||||
PyObject *pyVaultSDLNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultSDLNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL);
|
ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,11 +70,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultSystemNode, pyVaultSystemNode)
|
|||||||
PyObject *pyVaultSystemNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultSystemNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultSystemNode *newObj = (ptVaultSystemNode*)ptVaultSystemNode_type.tp_new(&ptVaultSystemNode_type, NULL, NULL);
|
ptVaultSystemNode *newObj = (ptVaultSystemNode*)ptVaultSystemNode_type.tp_new(&ptVaultSystemNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,11 +318,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultTextNoteNode, pyVaultTextNoteNode)
|
|||||||
PyObject *pyVaultTextNoteNode::New(RelVaultNode* nfsNode)
|
PyObject *pyVaultTextNoteNode::New(RelVaultNode* nfsNode)
|
||||||
{
|
{
|
||||||
ptVaultTextNoteNode *newObj = (ptVaultTextNoteNode*)ptVaultTextNoteNode_type.tp_new(&ptVaultTextNoteNode_type, NULL, NULL);
|
ptVaultTextNoteNode *newObj = (ptVaultTextNoteNode*)ptVaultTextNoteNode_type.tp_new(&ptVaultTextNoteNode_type, NULL, NULL);
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->UnRef();
|
|
||||||
newObj->fThis->fNode = nfsNode;
|
newObj->fThis->fNode = nfsNode;
|
||||||
if (newObj->fThis->fNode)
|
|
||||||
newObj->fThis->fNode->Ref();
|
|
||||||
return (PyObject*)newObj;
|
return (PyObject*)newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1471,10 +1471,8 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
hsUNIXStream S;
|
hsUNIXStream S;
|
||||||
if (!S.Open(filename, "wb")) {
|
if (!S.Open(filename, "wb"))
|
||||||
rvn->UnRef();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
S.WriteByte(fGroup);
|
S.WriteByte(fGroup);
|
||||||
|
|
||||||
@ -1614,7 +1612,7 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
|
|||||||
hsTArray<plClosetItem> closet;
|
hsTArray<plClosetItem> closet;
|
||||||
GetClosetItems(closet);
|
GetClosetItems(closet);
|
||||||
|
|
||||||
ARRAY(RelVaultNode*) templates;
|
RelVaultNode::RefList templates;
|
||||||
|
|
||||||
for (unsigned i = 0; i < items.GetCount(); ++i) {
|
for (unsigned i = 0; i < items.GetCount(); ++i) {
|
||||||
bool match = false;
|
bool match = false;
|
||||||
@ -1632,26 +1630,24 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
|
|||||||
plStateDataRecord rec(plClothingSDLModifier::GetClothingItemSDRName());
|
plStateDataRecord rec(plClothingSDLModifier::GetClothingItemSDRName());
|
||||||
plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec);
|
plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec);
|
||||||
|
|
||||||
RelVaultNode * templateNode = new RelVaultNode;
|
hsRef<RelVaultNode> templateNode = new RelVaultNode;
|
||||||
templateNode->Ref();
|
|
||||||
templateNode->SetNodeType(plVault::kNodeType_SDL);
|
templateNode->SetNodeType(plVault::kNodeType_SDL);
|
||||||
|
|
||||||
VaultSDLNode sdl(templateNode);
|
VaultSDLNode sdl(templateNode);
|
||||||
sdl.SetStateDataRecord(&rec);
|
sdl.SetStateDataRecord(&rec);
|
||||||
|
|
||||||
templates.Add(templateNode);
|
templates.push_back(templateNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < templates.Count(); ++i) {
|
for (const hsRef<RelVaultNode> &temp : templates) {
|
||||||
ENetError result;
|
ENetError result;
|
||||||
if (hsRef<RelVaultNode> actual = VaultCreateNodeAndWait(templates[i], &result)) {
|
if (hsRef<RelVaultNode> actual = VaultCreateNodeAndWait(temp, &result)) {
|
||||||
VaultAddChildNodeAndWait(
|
VaultAddChildNodeAndWait(
|
||||||
rvn->GetNodeId(),
|
rvn->GetNodeId(),
|
||||||
actual->GetNodeId(),
|
actual->GetNodeId(),
|
||||||
NetCommGetPlayer()->playerInt
|
NetCommGetPlayer()->playerInt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
templates[i]->UnRef(); // REF: Create
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ struct VaultFetchNodeTrans : NetAuthTrans {
|
|||||||
FNetCliAuthVaultNodeFetched m_callback;
|
FNetCliAuthVaultNodeFetched m_callback;
|
||||||
void * m_param;
|
void * m_param;
|
||||||
|
|
||||||
NetVaultNode * m_node;
|
hsRef<NetVaultNode> m_node;
|
||||||
|
|
||||||
VaultFetchNodeTrans (
|
VaultFetchNodeTrans (
|
||||||
unsigned nodeId,
|
unsigned nodeId,
|
||||||
@ -751,14 +751,13 @@ struct VaultFindNodeTrans : NetAuthTrans {
|
|||||||
FNetCliAuthVaultNodeFind m_callback;
|
FNetCliAuthVaultNodeFind m_callback;
|
||||||
void * m_param;
|
void * m_param;
|
||||||
|
|
||||||
NetVaultNode * m_node;
|
hsRef<NetVaultNode> m_node;
|
||||||
|
|
||||||
VaultFindNodeTrans (
|
VaultFindNodeTrans (
|
||||||
NetVaultNode * templateNode,
|
NetVaultNode * templateNode,
|
||||||
FNetCliAuthVaultNodeFind callback,
|
FNetCliAuthVaultNodeFind callback,
|
||||||
void * param
|
void * param
|
||||||
);
|
);
|
||||||
~VaultFindNodeTrans ();
|
|
||||||
|
|
||||||
|
|
||||||
bool Send ();
|
bool Send ();
|
||||||
@ -774,7 +773,7 @@ struct VaultFindNodeTrans : NetAuthTrans {
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
struct VaultCreateNodeTrans : NetAuthTrans {
|
struct VaultCreateNodeTrans : NetAuthTrans {
|
||||||
|
|
||||||
NetVaultNode * m_templateNode;
|
hsRef<NetVaultNode> m_templateNode;
|
||||||
FNetCliAuthVaultNodeCreated m_callback;
|
FNetCliAuthVaultNodeCreated m_callback;
|
||||||
void * m_param;
|
void * m_param;
|
||||||
|
|
||||||
@ -3940,8 +3939,6 @@ void VaultFetchNodeTrans::Post () {
|
|||||||
m_param,
|
m_param,
|
||||||
m_node
|
m_node
|
||||||
);
|
);
|
||||||
if (m_node)
|
|
||||||
m_node->UnRef("Recv");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -3954,7 +3951,6 @@ bool VaultFetchNodeTrans::Recv (
|
|||||||
if (IS_NET_SUCCESS(reply.result)) {
|
if (IS_NET_SUCCESS(reply.result)) {
|
||||||
m_node = new NetVaultNode;
|
m_node = new NetVaultNode;
|
||||||
m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0);
|
m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0);
|
||||||
m_node->Ref("Recv");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_result = reply.result;
|
m_result = reply.result;
|
||||||
@ -3980,12 +3976,6 @@ VaultFindNodeTrans::VaultFindNodeTrans (
|
|||||||
, m_param(param)
|
, m_param(param)
|
||||||
, m_node(templateNode)
|
, m_node(templateNode)
|
||||||
{
|
{
|
||||||
m_node->Ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
VaultFindNodeTrans::~VaultFindNodeTrans () {
|
|
||||||
m_node->UnRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -4056,7 +4046,6 @@ VaultCreateNodeTrans::VaultCreateNodeTrans (
|
|||||||
, m_param(param)
|
, m_param(param)
|
||||||
, m_nodeId(0)
|
, m_nodeId(0)
|
||||||
{
|
{
|
||||||
m_templateNode->Ref();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -4086,7 +4075,6 @@ void VaultCreateNodeTrans::Post () {
|
|||||||
m_param,
|
m_param,
|
||||||
m_nodeId
|
m_nodeId
|
||||||
);
|
);
|
||||||
m_templateNode->UnRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -104,7 +104,7 @@ struct RelVaultNodeLink : THashKeyVal<unsigned> {
|
|||||||
|
|
||||||
|
|
||||||
struct IRelVaultNode {
|
struct IRelVaultNode {
|
||||||
RelVaultNode * node;
|
hsRef<RelVaultNode> node;
|
||||||
|
|
||||||
HASHTABLEDECL(
|
HASHTABLEDECL(
|
||||||
RelVaultNodeLink,
|
RelVaultNodeLink,
|
||||||
@ -135,7 +135,7 @@ struct VaultCreateNodeTrans {
|
|||||||
void * param;
|
void * param;
|
||||||
|
|
||||||
unsigned nodeId;
|
unsigned nodeId;
|
||||||
RelVaultNode * node;
|
hsRef<RelVaultNode> node;
|
||||||
|
|
||||||
VaultCreateNodeTrans ()
|
VaultCreateNodeTrans ()
|
||||||
: callback(nil), state(nil), param(nil), nodeId(0), node(nil) { }
|
: callback(nil), state(nil), param(nil), nodeId(0), node(nil) { }
|
||||||
@ -397,8 +397,8 @@ static void BuildNodeTree (
|
|||||||
childLink->ownerId = ownerId;
|
childLink->ownerId = ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
RelVaultNode * parentNode = parentLink->node;
|
hsRef<RelVaultNode> parentNode = parentLink->node;
|
||||||
RelVaultNode * childNode = childLink->node;
|
hsRef<RelVaultNode> childNode = childLink->node;
|
||||||
|
|
||||||
bool isImmediateParent = parentNode->IsParentOf(refs[i].childId, 1);
|
bool isImmediateParent = parentNode->IsParentOf(refs[i].childId, 1);
|
||||||
bool isImmediateChild = childNode->IsChildOf(refs[i].parentId, 1);
|
bool isImmediateChild = childNode->IsChildOf(refs[i].parentId, 1);
|
||||||
@ -1316,10 +1316,9 @@ void RelVaultNode::GetChildNodes (
|
|||||||
RelVaultNodeLink * link;
|
RelVaultNodeLink * link;
|
||||||
link = state->children.Head();
|
link = state->children.Head();
|
||||||
for (; link; link = state->children.Next(link)) {
|
for (; link; link = state->children.Next(link)) {
|
||||||
if (link->node->Matches(templateNode)) {
|
if (link->node->Matches(templateNode))
|
||||||
nodes->push_back(link->node);
|
nodes->push_back(link->node);
|
||||||
link->node->Ref();
|
|
||||||
}
|
|
||||||
link->node->GetChildNodes(
|
link->node->GetChildNodes(
|
||||||
templateNode,
|
templateNode,
|
||||||
maxDepth - 1,
|
maxDepth - 1,
|
||||||
|
Reference in New Issue
Block a user