Browse Source

Use hsRef for storage of the remaining vault nodes

Michael Hansen 11 years ago
parent
commit
403528a24b
  1. 4
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNodeGlue.cpp
  3. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp
  4. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNodeGlue.cpp
  5. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNodeGlue.cpp
  6. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp
  7. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp
  8. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp
  9. 45
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  10. 9
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h
  11. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp
  12. 16
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp
  13. 11
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h
  14. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRefGlue.cpp
  15. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp
  16. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNodeGlue.cpp
  17. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp
  18. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNodeGlue.cpp
  19. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNodeGlue.cpp
  20. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNodeGlue.cpp
  21. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp
  22. 16
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  23. 18
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  24. 13
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

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

@ -554,14 +554,12 @@ void _InvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID )
{
NetVaultNode * templateNode = new NetVaultNode;
templateNode->Ref();
hsRef<NetVaultNode> templateNode = new NetVaultNode;
templateNode->SetNodeType(plVault::kNodeType_TextNote);
VaultTextNoteNode visitAcc(templateNode);
visitAcc.SetNoteType(plVault::kNoteType_Visit);
visitAcc.SetVisitInfo(*link.GetAgeLink()->GetAgeInfo());
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, (void*)playerID);
templateNode->UnRef();
}
//============================================================================

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

@ -111,11 +111,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeInfoListNode, pyVaultFolderNode, "Params: n=
PyObject *pyVaultAgeInfoListNode::New(RelVaultNode* nfsNode)
{
ptVaultAgeInfoListNode *newObj = (ptVaultAgeInfoListNode*)ptVaultAgeInfoListNode_type.tp_new(&ptVaultAgeInfoListNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -287,11 +287,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeInfoNode, pyVaultNode, "Params: n=0\nPlasma
PyObject *pyVaultAgeInfoNode::New(RelVaultNode* nfsNode)
{
ptVaultAgeInfoNode *newObj = (ptVaultAgeInfoNode*)ptVaultAgeInfoNode_type.tp_new(&ptVaultAgeInfoNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -200,11 +200,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultAgeLinkNode, pyVaultNode, "Params: n=0\nPlasma
PyObject *pyVaultAgeLinkNode::New(RelVaultNode* nfsNode)
{
ptVaultAgeLinkNode *newObj = (ptVaultAgeLinkNode*)ptVaultAgeLinkNode_type.tp_new(&ptVaultAgeLinkNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -190,11 +190,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultChronicleNode, pyVaultNode, "Params: n=0\nPlasm
PyObject *pyVaultChronicleNode::New(RelVaultNode* nfsNode)
{
ptVaultChronicleNode *newObj = (ptVaultChronicleNode*)ptVaultChronicleNode_type.tp_new(&ptVaultChronicleNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -191,11 +191,7 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultFolderNode, pyVaultFolderNode);
PyObject *pyVaultFolderNode::New(RelVaultNode* nfsNode)
{
ptVaultFolderNode *newObj = (ptVaultFolderNode*)ptVaultFolderNode_type.tp_new(&ptVaultFolderNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -219,11 +219,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultImageNode, pyVaultNode, "Params: n=0\nPlasma va
PyObject *pyVaultImageNode::New(RelVaultNode* nfsNode)
{
ptVaultImageNode *newObj = (ptVaultImageNode*)ptVaultImageNode_type.tp_new(&ptVaultImageNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -114,11 +114,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultMarkerGameNode, pyVaultNode, "Params: n=0\nPlas
PyObject *pyVaultMarkerGameNode::New(RelVaultNode* nfsNode)
{
ptVaultMarkerGameNode *newObj = (ptVaultMarkerGameNode*)ptVaultMarkerGameNode_type.tp_new(&ptVaultMarkerGameNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -94,7 +94,6 @@ static void CDECL LogDumpProc (
pyVaultNode::pyVaultNodeOperationCallback::pyVaultNodeOperationCallback(PyObject * cbObject)
: fCbObject( cbObject )
, fNode(nil)
, fPyNodeRef(nil)
, fContext(0)
{
@ -158,21 +157,16 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( uint32_t
}
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) {
if (rvn)
rvn->Ref();
SWAP(rvn, fNode);
if (rvn)
rvn->UnRef();
fNode = rvn;
}
RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () {
hsRef<RelVaultNode> pyVaultNode::pyVaultNodeOperationCallback::GetNode() const {
return fNode;
}
// only for python glue, do NOT call
pyVaultNode::pyVaultNode()
: fNode(nil)
, fCreateAgeName(nil)
: fCreateAgeName(nil)
{
}
@ -181,19 +175,15 @@ pyVaultNode::pyVaultNode( RelVaultNode* nfsNode )
: fNode(nfsNode)
, fCreateAgeName(nil)
{
if (fNode)
fNode->Ref("pyVaultNode");
}
pyVaultNode::~pyVaultNode()
{
if (fNode)
fNode->UnRef("pyVaultNode");
free(fCreateAgeName);
}
RelVaultNode* pyVaultNode::GetNode() const
hsRef<RelVaultNode> pyVaultNode::GetNode() const
{
return fNode;
}
@ -202,8 +192,8 @@ RelVaultNode* pyVaultNode::GetNode() const
// override the equals to operator
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
{
RelVaultNode* ours = GetNode();
RelVaultNode* theirs = vaultNode.GetNode();
hsRef<RelVaultNode> ours = GetNode();
hsRef<RelVaultNode> theirs = vaultNode.GetNode();
if (ours == nil && theirs == nil)
return true;
if (ours == nil || theirs == nil)
@ -418,14 +408,10 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
&result
);
if (newNode) {
newNode->Ref();
pynode->fNode->UnRef();
if (newNode)
pynode->fNode = newNode;
}
else {
else
hsResult = hsFail;
}
}
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.
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
node->Ref();
fNode->UnRef();
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
fNode = node;
}
}
pyVaultNodeOperationCallback * cb = new pyVaultNodeOperationCallback( cbObject );
cb->SetNode(fNode);
@ -555,11 +538,8 @@ void pyVaultNode::ForceSave()
{
if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
node->Ref();
fNode->UnRef();
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
fNode = node;
}
}
else
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 (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result;
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result)) {
node->Ref();
fNode->UnRef();
if (hsRef<RelVaultNode> node = VaultCreateNodeAndWait(fNode, &result))
fNode = node;
}
}
// Hack the callbacks until vault notification is in place

9
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h

@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include "hsRefCnt.h"
struct RelVaultNode;
class plMipmap;
@ -82,7 +83,7 @@ public:
struct pyVaultNodeOperationCallback
{
PyObject * fCbObject;
RelVaultNode * fNode;
hsRef<RelVaultNode> fNode;
PyObject * fPyNodeRef;
uint32_t fContext;
@ -94,10 +95,10 @@ public:
void VaultOperationComplete(int resultCode) { VaultOperationComplete(fContext, resultCode); }
void SetNode (RelVaultNode * rvn);
RelVaultNode * GetNode ();
hsRef<RelVaultNode> GetNode() const;
};
RelVaultNode * fNode;
hsRef<RelVaultNode> fNode;
mutable char * fCreateAgeName;
protected:
@ -118,7 +119,7 @@ public:
static void AddPlasmaClasses(PyObject *m);
RelVaultNode * GetNode() const;
hsRef<RelVaultNode> GetNode() const;
// override the equals to operator
bool operator==(const pyVaultNode &vaultNode) const;

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

@ -541,11 +541,7 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultNode, pyVaultNode);
PyObject *pyVaultNode::New(RelVaultNode* nfsNode)
{
ptVaultNode *newObj = (ptVaultNode*)ptVaultNode_type.tp_new(&ptVaultNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -65,22 +65,20 @@ pyVaultNodeRef::pyVaultNodeRef(RelVaultNode * parent, RelVaultNode * child)
: fParent(parent)
, fChild(child)
{
fParent->Ref();
fChild->Ref();
}
pyVaultNodeRef::pyVaultNodeRef(int)
: fParent(nil)
, fChild(nil)
{
}
pyVaultNodeRef::~pyVaultNodeRef()
hsRef<RelVaultNode> pyVaultNodeRef::GetParentNode() const
{
if (fParent)
fParent->UnRef();
if (fChild)
fChild->UnRef();
return fParent;
}
hsRef<RelVaultNode> pyVaultNodeRef::GetChildNode() const
{
return fChild;
}

11
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h

@ -50,13 +50,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include "hsRefCnt.h"
struct RelVaultNode;
class pyVaultNodeRef
{
RelVaultNode * fParent;
RelVaultNode * fChild;
hsRef<RelVaultNode> fParent;
hsRef<RelVaultNode> fChild;
protected:
// should only be created from C++ side
@ -64,10 +65,8 @@ protected:
pyVaultNodeRef(int =0 );
public:
~pyVaultNodeRef();
RelVaultNode * GetParentNode () const { return fParent; }
RelVaultNode * GetChildNode () const { return fChild; }
hsRef<RelVaultNode> GetParentNode() const;
hsRef<RelVaultNode> GetChildNode() const;
// required functions for PyObject interoperability
PYTHON_EXPOSE_TYPE; // so we can subclass

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

@ -125,16 +125,8 @@ PYTHON_EXPOSE_TYPE_DEFINITION(ptVaultNodeRef, pyVaultNodeRef);
PyObject *pyVaultNodeRef::New(RelVaultNode * parent, RelVaultNode * child)
{
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->fChild = child;
if (newObj->fThis->fParent)
newObj->fThis->fParent->Ref();
if (newObj->fThis->fChild)
newObj->fThis->fChild->Ref();
return (PyObject*)newObj;
}

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

@ -93,10 +93,9 @@ bool pyVaultPlayerInfoListNode::HasPlayer( uint32_t playerID )
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)
VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
parent->UnRef();
}
void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
@ -104,8 +103,7 @@ void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
if (HasPlayer(playerID) || !fNode)
return;
NetVaultNode* templateNode = new NetVaultNode();
templateNode->Ref();
hsRef<NetVaultNode> templateNode = new NetVaultNode();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode);
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.
if (nodeIds.Count())
VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
else {
fNode->Ref();
else
VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode);
}
}
void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )

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

@ -179,11 +179,7 @@ PLASMA_DEFAULT_TYPE_WBASE(ptVaultPlayerInfoListNode, pyVaultFolderNode, "Params:
PyObject *pyVaultPlayerInfoListNode::New(RelVaultNode* nfsNode)
{
ptVaultPlayerInfoListNode *newObj = (ptVaultPlayerInfoListNode*)ptVaultPlayerInfoListNode_type.tp_new(&ptVaultPlayerInfoListNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -171,11 +171,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultPlayerInfoNode, pyVaultPlayerInfoNode)
PyObject *pyVaultPlayerInfoNode::New(RelVaultNode* nfsNode)
{
ptVaultPlayerInfoNode *newObj = (ptVaultPlayerInfoNode*)ptVaultPlayerInfoNode_type.tp_new(&ptVaultPlayerInfoNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -321,11 +321,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultPlayerNode, pyVaultPlayerNode)
PyObject *pyVaultPlayerNode::New(RelVaultNode* nfsNode)
{
ptVaultPlayerNode *newObj = (ptVaultPlayerNode*)ptVaultPlayerNode_type.tp_new(&ptVaultPlayerNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -129,11 +129,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultSDLNode, pyVaultSDLNode)
PyObject *pyVaultSDLNode::New(RelVaultNode* nfsNode)
{
ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -70,11 +70,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultSystemNode, pyVaultSystemNode)
PyObject *pyVaultSystemNode::New(RelVaultNode* nfsNode)
{
ptVaultSystemNode *newObj = (ptVaultSystemNode*)ptVaultSystemNode_type.tp_new(&ptVaultSystemNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -318,11 +318,7 @@ PYTHON_CLASS_NEW_IMPL(ptVaultTextNoteNode, pyVaultTextNoteNode)
PyObject *pyVaultTextNoteNode::New(RelVaultNode* nfsNode)
{
ptVaultTextNoteNode *newObj = (ptVaultTextNoteNode*)ptVaultTextNoteNode_type.tp_new(&ptVaultTextNoteNode_type, NULL, NULL);
if (newObj->fThis->fNode)
newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode)
newObj->fThis->fNode->Ref();
return (PyObject*)newObj;
}

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

@ -1471,10 +1471,8 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
return false;
hsUNIXStream S;
if (!S.Open(filename, "wb")) {
rvn->UnRef();
if (!S.Open(filename, "wb"))
return false;
}
S.WriteByte(fGroup);
@ -1614,7 +1612,7 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
hsTArray<plClosetItem> closet;
GetClosetItems(closet);
ARRAY(RelVaultNode*) templates;
RelVaultNode::RefList templates;
for (unsigned i = 0; i < items.GetCount(); ++i) {
bool match = false;
@ -1632,26 +1630,24 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
plStateDataRecord rec(plClothingSDLModifier::GetClothingItemSDRName());
plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec);
RelVaultNode * templateNode = new RelVaultNode;
templateNode->Ref();
hsRef<RelVaultNode> templateNode = new RelVaultNode;
templateNode->SetNodeType(plVault::kNodeType_SDL);
VaultSDLNode sdl(templateNode);
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;
if (hsRef<RelVaultNode> actual = VaultCreateNodeAndWait(templates[i], &result)) {
if (hsRef<RelVaultNode> actual = VaultCreateNodeAndWait(temp, &result)) {
VaultAddChildNodeAndWait(
rvn->GetNodeId(),
actual->GetNodeId(),
NetCommGetPlayer()->playerInt
);
}
templates[i]->UnRef(); // REF: Create
}
}

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

@ -726,7 +726,7 @@ struct VaultFetchNodeTrans : NetAuthTrans {
FNetCliAuthVaultNodeFetched m_callback;
void * m_param;
NetVaultNode * m_node;
hsRef<NetVaultNode> m_node;
VaultFetchNodeTrans (
unsigned nodeId,
@ -751,14 +751,13 @@ struct VaultFindNodeTrans : NetAuthTrans {
FNetCliAuthVaultNodeFind m_callback;
void * m_param;
NetVaultNode * m_node;
hsRef<NetVaultNode> m_node;
VaultFindNodeTrans (
NetVaultNode * templateNode,
FNetCliAuthVaultNodeFind callback,
void * param
);
~VaultFindNodeTrans ();
bool Send ();
@ -774,7 +773,7 @@ struct VaultFindNodeTrans : NetAuthTrans {
//============================================================================
struct VaultCreateNodeTrans : NetAuthTrans {
NetVaultNode * m_templateNode;
hsRef<NetVaultNode> m_templateNode;
FNetCliAuthVaultNodeCreated m_callback;
void * m_param;
@ -3940,8 +3939,6 @@ void VaultFetchNodeTrans::Post () {
m_param,
m_node
);
if (m_node)
m_node->UnRef("Recv");
}
//============================================================================
@ -3954,7 +3951,6 @@ bool VaultFetchNodeTrans::Recv (
if (IS_NET_SUCCESS(reply.result)) {
m_node = new NetVaultNode;
m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0);
m_node->Ref("Recv");
}
m_result = reply.result;
@ -3980,12 +3976,6 @@ VaultFindNodeTrans::VaultFindNodeTrans (
, m_param(param)
, m_node(templateNode)
{
m_node->Ref();
}
//============================================================================
VaultFindNodeTrans::~VaultFindNodeTrans () {
m_node->UnRef();
}
//============================================================================
@ -4056,7 +4046,6 @@ VaultCreateNodeTrans::VaultCreateNodeTrans (
, m_param(param)
, m_nodeId(0)
{
m_templateNode->Ref();
}
//============================================================================
@ -4086,7 +4075,6 @@ void VaultCreateNodeTrans::Post () {
m_param,
m_nodeId
);
m_templateNode->UnRef();
}
//============================================================================

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

@ -104,7 +104,7 @@ struct RelVaultNodeLink : THashKeyVal<unsigned> {
struct IRelVaultNode {
RelVaultNode * node;
hsRef<RelVaultNode> node;
HASHTABLEDECL(
RelVaultNodeLink,
@ -135,7 +135,7 @@ struct VaultCreateNodeTrans {
void * param;
unsigned nodeId;
RelVaultNode * node;
hsRef<RelVaultNode> node;
VaultCreateNodeTrans ()
: callback(nil), state(nil), param(nil), nodeId(0), node(nil) { }
@ -397,8 +397,8 @@ static void BuildNodeTree (
childLink->ownerId = ownerId;
}
RelVaultNode * parentNode = parentLink->node;
RelVaultNode * childNode = childLink->node;
hsRef<RelVaultNode> parentNode = parentLink->node;
hsRef<RelVaultNode> childNode = childLink->node;
bool isImmediateParent = parentNode->IsParentOf(refs[i].childId, 1);
bool isImmediateChild = childNode->IsChildOf(refs[i].parentId, 1);
@ -1316,10 +1316,9 @@ void RelVaultNode::GetChildNodes (
RelVaultNodeLink * link;
link = state->children.Head();
for (; link; link = state->children.Next(link)) {
if (link->node->Matches(templateNode)) {
if (link->node->Matches(templateNode))
nodes->push_back(link->node);
link->node->Ref();
}
link->node->GetChildNodes(
templateNode,
maxDepth - 1,

Loading…
Cancel
Save