|
|
@ -60,6 +60,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
|
|
|
|
|
|
|
|
#include "plSDL/plSDL.h" |
|
|
|
#include "plSDL/plSDL.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//============================================================================
|
|
|
|
static PyObject * GetFolder (unsigned folderType) { |
|
|
|
static PyObject * GetFolder (unsigned folderType) { |
|
|
@ -349,7 +352,7 @@ void pyVault::AddChronicleEntry( const char * name, UInt32 type, const char * va |
|
|
|
wchar * wEntryName = StrDupToUnicode(name); |
|
|
|
wchar * wEntryName = StrDupToUnicode(name); |
|
|
|
wchar * wEntryValue = StrDupToUnicode(value); |
|
|
|
wchar * wEntryValue = StrDupToUnicode(value); |
|
|
|
|
|
|
|
|
|
|
|
VaultAddChronicleEntryAndWait(wEntryName, type, wEntryValue); |
|
|
|
VaultAddChronicleEntry(wEntryName, type, wEntryValue); |
|
|
|
|
|
|
|
|
|
|
|
FREE(wEntryName); |
|
|
|
FREE(wEntryName); |
|
|
|
FREE(wEntryValue); |
|
|
|
FREE(wEntryValue); |
|
|
@ -362,7 +365,9 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
wchar wDevName[256]; |
|
|
|
wchar wDevName[256]; |
|
|
|
StrToUnicode(wDevName, deviceName, arrsize(wDevName));
|
|
|
|
StrToUnicode(wDevName, deviceName, arrsize(wDevName)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: This actually blocks (~Hoikas)
|
|
|
|
VaultPublishNode(node.GetNode()->nodeId, wDevName); |
|
|
|
VaultPublishNode(node.GetNode()->nodeId, wDevName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -528,12 +533,14 @@ void pyVault::RegisterMTStation( const char * stationName, const char * backLink |
|
|
|
wchar wSpawnPt[256]; |
|
|
|
wchar wSpawnPt[256]; |
|
|
|
StrToUnicode(wStationName, stationName, arrsize(wStationName)); |
|
|
|
StrToUnicode(wStationName, stationName, arrsize(wStationName)); |
|
|
|
StrToUnicode(wSpawnPt, backLinkSpawnPtObjName, arrsize(wSpawnPt)); |
|
|
|
StrToUnicode(wSpawnPt, backLinkSpawnPtObjName, arrsize(wSpawnPt)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: This doesn't actually block (~Hoikas)
|
|
|
|
VaultRegisterMTStationAndWait( wStationName, wSpawnPt); |
|
|
|
VaultRegisterMTStationAndWait( wStationName, wSpawnPt); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void pyVault::RegisterOwnedAge( const pyAgeLinkStruct & link ) |
|
|
|
void pyVault::RegisterOwnedAge( const pyAgeLinkStruct & link ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
VaultRegisterOwnedAgeAndWait(link.GetAgeLink()); |
|
|
|
VaultRegisterOwnedAge(link.GetAgeLink()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void pyVault::UnRegisterOwnedAge( const char * ageFilename ) |
|
|
|
void pyVault::UnRegisterOwnedAge( const char * ageFilename ) |
|
|
@ -557,22 +564,27 @@ void pyVault::UnRegisterVisitAge( const char * guidstr ) |
|
|
|
VaultUnregisterVisitAgeAndWait(&info); |
|
|
|
VaultUnregisterVisitAgeAndWait(&info); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, UInt32 playerID ) |
|
|
|
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, UInt32 playerID ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ENetError error; |
|
|
|
|
|
|
|
NetVaultNode * templateNode = NEWZERO(NetVaultNode); |
|
|
|
NetVaultNode * templateNode = NEWZERO(NetVaultNode); |
|
|
|
templateNode->IncRef(); |
|
|
|
templateNode->IncRef(); |
|
|
|
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()); |
|
|
|
if (RelVaultNode * rvn = VaultCreateNodeAndWaitIncRef(templateNode, &error)) { |
|
|
|
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, TRACKED_NEW UInt32(playerID)); |
|
|
|
VaultSendNode(rvn, playerID); |
|
|
|
|
|
|
|
rvn->DecRef(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
templateNode->DecRef(); |
|
|
|
templateNode->DecRef(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _InvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode* node) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (result == kNetSuccess) |
|
|
|
|
|
|
|
VaultSendNode(node, *((UInt32*)param)); |
|
|
|
|
|
|
|
delete param; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void pyVault::UnInvitePlayerToAge( const char * str, UInt32 playerID ) |
|
|
|
void pyVault::UnInvitePlayerToAge( const char * str, UInt32 playerID ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plAgeInfoStruct info; |
|
|
|
plAgeInfoStruct info; |
|
|
@ -588,30 +600,36 @@ void pyVault::UnInvitePlayerToAge( const char * str, UInt32 playerID ) |
|
|
|
rvnLink->DecRef(); |
|
|
|
rvnLink->DecRef(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ENetError error; |
|
|
|
|
|
|
|
NetVaultNode * templateNode = NEWZERO(NetVaultNode); |
|
|
|
NetVaultNode * templateNode = NEWZERO(NetVaultNode); |
|
|
|
templateNode->IncRef(); |
|
|
|
templateNode->IncRef(); |
|
|
|
templateNode->SetNodeType(plVault::kNodeType_TextNote); |
|
|
|
templateNode->SetNodeType(plVault::kNodeType_TextNote); |
|
|
|
VaultTextNoteNode visitAcc(templateNode); |
|
|
|
VaultTextNoteNode visitAcc(templateNode); |
|
|
|
visitAcc.SetNoteType(plVault::kNoteType_UnVisit); |
|
|
|
visitAcc.SetNoteType(plVault::kNoteType_UnVisit); |
|
|
|
visitAcc.SetVisitInfo(info); |
|
|
|
visitAcc.SetVisitInfo(info); |
|
|
|
if (RelVaultNode * rvn = VaultCreateNodeAndWaitIncRef(templateNode, &error)) { |
|
|
|
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_UninvitePlayerToAge, nil, TRACKED_NEW UInt32(playerID)); |
|
|
|
VaultSendNode(rvn, playerID); |
|
|
|
|
|
|
|
rvn->DecRef(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
templateNode->DecRef(); |
|
|
|
templateNode->DecRef(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _UninvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode* node) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (result == kNetSuccess) |
|
|
|
|
|
|
|
VaultSendNode(node, *((UInt32*)param)); |
|
|
|
|
|
|
|
delete param; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void pyVault::OfferLinkToPlayer( const pyAgeLinkStruct & link, UInt32 playerID ) |
|
|
|
void pyVault::OfferLinkToPlayer( const pyAgeLinkStruct & link, UInt32 playerID ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hsAssert(false, "eric, port me"); |
|
|
|
hsAssert(false, "eric, port me"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void pyVault::CreateNeighborhood() |
|
|
|
void pyVault::CreateNeighborhood() |
|
|
|
{ |
|
|
|
{ |
|
|
|
plNetClientMgr * nc = plNetClientMgr::GetInstance(); |
|
|
|
plNetClientMgr * nc = plNetClientMgr::GetInstance(); |
|
|
|
|
|
|
|
|
|
|
|
// Unregister old hood
|
|
|
|
// Unregister old hood
|
|
|
|
|
|
|
|
// Note: This doesn't actually block (~Hoikas)
|
|
|
|
plAgeInfoStruct info; |
|
|
|
plAgeInfoStruct info; |
|
|
|
info.SetAgeFilename(kNeighborhoodAgeFilename); |
|
|
|
info.SetAgeFilename(kNeighborhoodAgeFilename); |
|
|
|
VaultUnregisterOwnedAgeAndWait(&info); |
|
|
|
VaultUnregisterOwnedAgeAndWait(&info); |
|
|
@ -640,11 +658,12 @@ void pyVault::CreateNeighborhood() |
|
|
|
link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); |
|
|
|
link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); |
|
|
|
link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); |
|
|
|
link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); |
|
|
|
|
|
|
|
|
|
|
|
VaultRegisterOwnedAgeAndWait(&link); |
|
|
|
VaultRegisterOwnedAge(&link); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool pyVault::SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic ) |
|
|
|
bool pyVault::SetAgePublic( const pyAgeInfoStruct * ageInfo, bool makePublic ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// Note: This doesn't actually block (~Hoikas)
|
|
|
|
return VaultSetOwnedAgePublicAndWait(ageInfo->GetAgeInfo(), makePublic); |
|
|
|
return VaultSetOwnedAgePublicAndWait(ageInfo->GetAgeInfo(), makePublic); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|