mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 11:49:09 +00:00
Clean up string spin-washing in the Vault API
This commit is contained in:
@ -789,11 +789,7 @@ PF_CONSOLE_CMD( Net_Vault,
|
||||
"string stationName, string mtSpawnPt",
|
||||
"Register an MT Station with your Nexus" )
|
||||
{
|
||||
wchar_t wName[MAX_PATH];
|
||||
wchar_t wObj[MAX_PATH];
|
||||
StrToUnicode(wName, params[0], arrsize(wName));
|
||||
StrToUnicode(wObj, params[1], arrsize(wObj));
|
||||
VaultRegisterMTStationAndWait ( wName, wObj );
|
||||
VaultRegisterMTStationAndWait((char*)params[0], (char*)params[1]);
|
||||
PrintString("Registered MT Station.");
|
||||
}
|
||||
|
||||
|
@ -173,27 +173,18 @@ plUUID pyAgeVault::GetAgeGuid( void )
|
||||
|
||||
///////////////
|
||||
// Chronicle
|
||||
PyObject* pyAgeVault::FindChronicleEntry( const char * entryName )
|
||||
PyObject* pyAgeVault::FindChronicleEntry( const plString& entryName )
|
||||
{
|
||||
wchar_t wEntryName[kMaxVaultNodeStringLength];
|
||||
StrToUnicode(wEntryName, entryName, arrsize(wEntryName));
|
||||
|
||||
if (hsRef<RelVaultNode> rvn = VaultFindAgeChronicleEntry(wEntryName))
|
||||
if (hsRef<RelVaultNode> rvn = VaultFindAgeChronicleEntry(entryName))
|
||||
return pyVaultChronicleNode::New(rvn);
|
||||
|
||||
// just return a None object
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
void pyAgeVault::AddChronicleEntry( const char * name, uint32_t type, const char * value )
|
||||
void pyAgeVault::AddChronicleEntry( const plString& name, uint32_t type, const plString& value )
|
||||
{
|
||||
wchar_t * wEntryName = StrDupToUnicode(name);
|
||||
wchar_t * wEntryValue = StrDupToUnicode(value);
|
||||
|
||||
VaultAddAgeChronicleEntry(wEntryName, type, wEntryValue);
|
||||
|
||||
free(wEntryName);
|
||||
free(wEntryValue);
|
||||
VaultAddAgeChronicleEntry(name, type, value);
|
||||
}
|
||||
|
||||
// AGE DEVICES. AKA IMAGERS, WHATEVER.
|
||||
|
@ -92,8 +92,8 @@ public:
|
||||
PyObject* GetSubAgesFolder( void ); // returns pyVaultFolderNode
|
||||
PyObject* GetChronicleFolder( void ); // returns pyVaultFolderNode
|
||||
// Age chronicle (not the player chronicle!)
|
||||
PyObject* FindChronicleEntry( const char * entryName ); // returns pyVaultChronicleNode
|
||||
void AddChronicleEntry( const char * name, uint32_t type, const char * value );
|
||||
PyObject* FindChronicleEntry( const plString& entryName ); // returns pyVaultChronicleNode
|
||||
void AddChronicleEntry( const plString& name, uint32_t type, const plString& value );
|
||||
// Players who have published to devices in this age
|
||||
PyObject* GetPeopleIKnowAboutFolder( void ); // returns pyVaultPlayerInfoListNode
|
||||
// PERSONAL AGE SPECIFIC
|
||||
|
@ -489,15 +489,10 @@ bool pyVault::AmAgeCzar( const pyAgeInfoStruct * ageInfo )
|
||||
return VaultAmCzarOfAge(ageInstId);
|
||||
}
|
||||
|
||||
void pyVault::RegisterMTStation( const char * stationName, const char * backLinkSpawnPtObjName )
|
||||
void pyVault::RegisterMTStation( const plString& stationName, const plString& backLinkSpawnPtObjName )
|
||||
{
|
||||
wchar_t wStationName[256];
|
||||
wchar_t wSpawnPt[256];
|
||||
StrToUnicode(wStationName, stationName, arrsize(wStationName));
|
||||
StrToUnicode(wSpawnPt, backLinkSpawnPtObjName, arrsize(wSpawnPt));
|
||||
|
||||
// Note: This doesn't actually block (~Hoikas)
|
||||
VaultRegisterMTStationAndWait( wStationName, wSpawnPt);
|
||||
VaultRegisterMTStationAndWait(stationName, backLinkSpawnPtObjName);
|
||||
}
|
||||
|
||||
void pyVault::RegisterOwnedAge( const pyAgeLinkStruct & link )
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
void RegisterVisitAge( const pyAgeLinkStruct & link );
|
||||
void UnRegisterVisitAge( const char * guid );
|
||||
// Register a nexus station
|
||||
void RegisterMTStation( const char * stationName, const char * mtSpawnPt );
|
||||
void RegisterMTStation( const plString& stationName, const plString& mtSpawnPt );
|
||||
|
||||
///////////////
|
||||
// Invite player to visit an age.
|
||||
|
@ -1069,14 +1069,10 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
|
||||
case plNetCommon::LinkingRules::kChildAgeBook:
|
||||
{
|
||||
plAgeLinkStruct childLink;
|
||||
wchar_t parentAgeName[MAX_PATH];
|
||||
if (link->HasParentAgeFilename())
|
||||
StrToUnicode(parentAgeName, link->GetParentAgeFilename(), arrsize(parentAgeName));
|
||||
|
||||
switch(VaultAgeFindOrCreateChildAgeLink(
|
||||
(link->HasParentAgeFilename() ? parentAgeName : nil),
|
||||
info,
|
||||
&childLink))
|
||||
link->GetParentAgeFilename(),
|
||||
info,
|
||||
&childLink))
|
||||
{
|
||||
case static_cast<uint8_t>(hsFail):
|
||||
success = kLinkFailed;
|
||||
|
@ -686,10 +686,10 @@ struct VaultInitAgeTrans : NetAuthTrans {
|
||||
|
||||
plUUID m_ageInstId;
|
||||
plUUID m_parentAgeInstId;
|
||||
wchar_t * m_ageFilename;
|
||||
wchar_t * m_ageInstName;
|
||||
wchar_t * m_ageUserName;
|
||||
wchar_t * m_ageDesc;
|
||||
plString m_ageFilename;
|
||||
plString m_ageInstName;
|
||||
plString m_ageUserName;
|
||||
plString m_ageDesc;
|
||||
unsigned m_ageSequenceNumber;
|
||||
unsigned m_ageLanguage;
|
||||
|
||||
@ -701,10 +701,10 @@ struct VaultInitAgeTrans : NetAuthTrans {
|
||||
void * param, // optional
|
||||
const plUUID& ageInstId, // optional. is used in match
|
||||
const plUUID& parentAgeInstId, // optional. is used in match
|
||||
const wchar_t ageFilename[], // optional. is used in match
|
||||
const wchar_t ageInstName[], // optional. not used in match
|
||||
const wchar_t ageUserName[], // optional. not used in match
|
||||
const wchar_t ageDesc[], // optional. not used in match
|
||||
const plString ageFilename, // optional. is used in match
|
||||
const plString ageInstName, // optional. not used in match
|
||||
const plString ageUserName, // optional. not used in match
|
||||
const plString ageDesc, // optional. not used in match
|
||||
unsigned ageSequenceNumber, // optional. not used in match
|
||||
unsigned ageLanguage // optional. not used in match
|
||||
);
|
||||
@ -3815,10 +3815,10 @@ VaultInitAgeTrans::VaultInitAgeTrans (
|
||||
void * param, // optional
|
||||
const plUUID& ageInstId, // optional. is used in match
|
||||
const plUUID& parentAgeInstId, // optional. is used in match
|
||||
const wchar_t ageFilename[], // optional. is used in match
|
||||
const wchar_t ageInstName[], // optional. not used in match
|
||||
const wchar_t ageUserName[], // optional. not used in match
|
||||
const wchar_t ageDesc[], // optional. not used in match
|
||||
const plString ageFilename, // optional. is used in match
|
||||
const plString ageInstName, // optional. not used in match
|
||||
const plString ageUserName, // optional. not used in match
|
||||
const plString ageDesc, // optional. not used in match
|
||||
unsigned ageSequenceNumber, // optional. not used in match
|
||||
unsigned ageLanguage // optional. not used in match
|
||||
) : NetAuthTrans(kVaultInitAgeTrans)
|
||||
@ -3826,10 +3826,6 @@ VaultInitAgeTrans::VaultInitAgeTrans (
|
||||
, m_param(param)
|
||||
, m_ageInstId(ageInstId)
|
||||
, m_parentAgeInstId(parentAgeInstId)
|
||||
, m_ageFilename(StrDup(ageFilename ? ageFilename : L""))
|
||||
, m_ageInstName(StrDup(ageInstName ? ageInstName : L""))
|
||||
, m_ageUserName(StrDup(ageUserName ? ageUserName : L""))
|
||||
, m_ageDesc(StrDup(ageDesc ? ageDesc : L""))
|
||||
, m_ageSequenceNumber(ageSequenceNumber)
|
||||
, m_ageLanguage(ageLanguage)
|
||||
, m_ageId(0)
|
||||
@ -3839,10 +3835,6 @@ VaultInitAgeTrans::VaultInitAgeTrans (
|
||||
|
||||
//============================================================================
|
||||
VaultInitAgeTrans::~VaultInitAgeTrans () {
|
||||
free(m_ageFilename);
|
||||
free(m_ageInstName);
|
||||
free(m_ageUserName);
|
||||
free(m_ageDesc);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -3850,19 +3842,24 @@ bool VaultInitAgeTrans::Send () {
|
||||
if (!AcquireConn())
|
||||
return false;
|
||||
|
||||
plStringBuffer<uint16_t> ageFilename = m_ageFilename.ToUtf16();
|
||||
plStringBuffer<uint16_t> ageInstName = m_ageInstName.ToUtf16();
|
||||
plStringBuffer<uint16_t> ageUserName = m_ageUserName.ToUtf16();
|
||||
plStringBuffer<uint16_t> ageDesc = m_ageDesc.ToUtf16();
|
||||
|
||||
const uintptr_t msg[] = {
|
||||
kCli2Auth_VaultInitAgeRequest,
|
||||
m_transId,
|
||||
(uintptr_t) &m_ageInstId,
|
||||
(uintptr_t) &m_parentAgeInstId,
|
||||
(uintptr_t) m_ageFilename,
|
||||
(uintptr_t) m_ageInstName,
|
||||
(uintptr_t) m_ageUserName,
|
||||
(uintptr_t) m_ageDesc,
|
||||
m_ageSequenceNumber,
|
||||
m_ageLanguage,
|
||||
(uintptr_t) ageFilename.GetData(),
|
||||
(uintptr_t) ageInstName.GetData(),
|
||||
(uintptr_t) ageUserName.GetData(),
|
||||
(uintptr_t) ageDesc.GetData(),
|
||||
m_ageSequenceNumber,
|
||||
m_ageLanguage,
|
||||
};
|
||||
|
||||
|
||||
m_conn->Send(msg, arrsize(msg));
|
||||
|
||||
return true;
|
||||
@ -5736,10 +5733,10 @@ void NetCliAuthVaultSendNode (
|
||||
void NetCliAuthVaultInitAge (
|
||||
const plUUID& ageInstId, // optional. is used in match
|
||||
const plUUID& parentAgeInstId, // optional. is used in match
|
||||
const wchar_t ageFilename[], // optional. is used in match
|
||||
const wchar_t ageInstName[], // optional. not used in match
|
||||
const wchar_t ageUserName[], // optional. not used in match
|
||||
const wchar_t ageDesc[], // optional. not used in match
|
||||
const plString& ageFilename, // optional. is used in match
|
||||
const plString& ageInstName, // optional. not used in match
|
||||
const plString& ageUserName, // optional. not used in match
|
||||
const plString& ageDesc, // optional. not used in match
|
||||
unsigned ageSequenceNumber, // optional. not used in match
|
||||
unsigned ageLanguage, // optional. not used in match
|
||||
FNetCliAuthAgeInitCallback callback, // optional
|
||||
|
@ -521,10 +521,10 @@ typedef void (*FNetCliAuthAgeInitCallback) (
|
||||
void NetCliAuthVaultInitAge (
|
||||
const plUUID& ageInstId, // optional. is used in match
|
||||
const plUUID& parentAgeInstId, // optional. is used in match
|
||||
const wchar_t ageFilename[], // optional. is used in match
|
||||
const wchar_t ageInstName[], // optional. not used in match
|
||||
const wchar_t ageUserName[], // optional. not used in match
|
||||
const wchar_t ageDesc[], // optional. not used in match
|
||||
const plString& ageFilename, // optional. is used in match
|
||||
const plString& ageInstName, // optional. not used in match
|
||||
const plString& ageUserName, // optional. not used in match
|
||||
const plString& ageDesc, // optional. not used in match
|
||||
unsigned ageSequenceNumber, // optional. not used in match
|
||||
unsigned ageLanguage, // optional. not used in match
|
||||
FNetCliAuthAgeInitCallback callback, // optional
|
||||
|
@ -2074,23 +2074,13 @@ void VaultInitAge (
|
||||
) {
|
||||
VaultAgeInitTrans * trans = new VaultAgeInitTrans(callback, state, param);
|
||||
|
||||
wchar_t ageFilename[MAX_PATH];
|
||||
wchar_t ageInstName[MAX_PATH];
|
||||
wchar_t ageUserName[MAX_PATH];
|
||||
wchar_t ageDesc[1024];
|
||||
|
||||
StrToUnicode(ageFilename, info->GetAgeFilename(), arrsize(ageFilename));
|
||||
StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName));
|
||||
StrToUnicode(ageUserName, info->GetAgeUserDefinedName(), arrsize(ageUserName));
|
||||
StrToUnicode(ageDesc, info->GetAgeDescription(), arrsize(ageDesc));
|
||||
|
||||
NetCliAuthVaultInitAge(
|
||||
*info->GetAgeInstanceGuid(),
|
||||
parentAgeInstId,
|
||||
ageFilename,
|
||||
ageInstName,
|
||||
ageUserName,
|
||||
ageDesc,
|
||||
info->GetAgeFilename(),
|
||||
info->GetAgeInstanceName(),
|
||||
info->GetAgeUserDefinedName(),
|
||||
info->GetAgeDescription(),
|
||||
info->GetAgeSequenceNumber(),
|
||||
info->GetAgeLanguage(),
|
||||
VaultAgeInitTrans::AgeInitCallback,
|
||||
@ -3440,17 +3430,14 @@ bool VaultAmCzarOfAge (const plUUID& ageInstId) {
|
||||
|
||||
//============================================================================
|
||||
bool VaultRegisterMTStationAndWait (
|
||||
const wchar_t stationName[],
|
||||
const wchar_t linkBackSpawnPtObjName[]
|
||||
const plString& stationName,
|
||||
const plString& linkBackSpawnPtObjName
|
||||
) {
|
||||
plAgeInfoStruct info;
|
||||
info.SetAgeFilename(kCityAgeFilename);
|
||||
if (hsRef<RelVaultNode> rvn = VaultGetOwnedAgeLink(&info)) {
|
||||
char title[MAX_PATH], spawnPt[MAX_PATH];
|
||||
StrToAnsi(title, stationName, arrsize(title));
|
||||
StrToAnsi(spawnPt, linkBackSpawnPtObjName, arrsize(spawnPt));
|
||||
VaultAgeLinkNode link(rvn);
|
||||
link.AddSpawnPoint(plSpawnPointInfo(title, spawnPt));
|
||||
link.AddSpawnPoint({ stationName, linkBackSpawnPtObjName });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -3669,16 +3656,16 @@ hsRef<RelVaultNode> VaultFindAgeSubAgeLink (const plAgeInfoStruct * info) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
hsRef<RelVaultNode> VaultFindAgeChronicleEntry (const wchar_t entryName[], int entryType) {
|
||||
hsRef<RelVaultNode> VaultFindAgeChronicleEntry (const plString& entryName, int entryType) {
|
||||
hsAssert(false, "eric, implement me");
|
||||
return nil;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void VaultAddAgeChronicleEntry (
|
||||
const wchar_t entryName[],
|
||||
int entryType,
|
||||
const wchar_t entryValue[]
|
||||
const plString& entryName,
|
||||
int entryType,
|
||||
const plString& entryValue
|
||||
) {
|
||||
hsAssert(false, "eric, implement me");
|
||||
}
|
||||
@ -4258,7 +4245,7 @@ static void _AddChildNodeCallback (
|
||||
|
||||
//============================================================================
|
||||
bool VaultAgeFindOrCreateChildAgeLinkAndWait (
|
||||
const wchar_t parentAgeName[],
|
||||
const plString& parentAgeName,
|
||||
const plAgeInfoStruct * info,
|
||||
plAgeLinkStruct * link
|
||||
) {
|
||||
@ -4270,15 +4257,12 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait (
|
||||
|
||||
{ // Get id of child ages folder
|
||||
hsRef<RelVaultNode> rvnAgeInfo;
|
||||
if (parentAgeName) {
|
||||
char ansi[MAX_PATH];
|
||||
StrToAnsi(ansi, parentAgeName, arrsize(ansi));
|
||||
if (!parentAgeName.IsEmpty()) {
|
||||
plAgeInfoStruct pinfo;
|
||||
pinfo.SetAgeFilename(ansi);
|
||||
pinfo.SetAgeFilename(parentAgeName);
|
||||
if (hsRef<RelVaultNode> rvnAgeLink = VaultGetOwnedAgeLink(&pinfo))
|
||||
rvnAgeInfo = rvnAgeLink->GetChildNode(plVault::kNodeType_AgeInfo, 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rvnAgeInfo = VaultGetAgeInfoNode();
|
||||
}
|
||||
|
||||
@ -4519,17 +4503,15 @@ namespace _VaultCreateChildAge {
|
||||
}; // namespace _VaultCreateAge
|
||||
|
||||
uint8_t VaultAgeFindOrCreateChildAgeLink(
|
||||
const wchar_t parentAgeName[],
|
||||
const plString& parentAgeName,
|
||||
const plAgeInfoStruct* info,
|
||||
plAgeLinkStruct* link)
|
||||
{
|
||||
using namespace _VaultCreateChildAge;
|
||||
|
||||
// First, try to find an already existing ChildAge
|
||||
char name[MAX_PATH];
|
||||
StrToAnsi(name, parentAgeName, arrsize(name));
|
||||
plAgeInfoStruct search;
|
||||
search.SetAgeFilename(name);
|
||||
search.SetAgeFilename(parentAgeName);
|
||||
|
||||
hsRef<RelVaultNode> rvnParentInfo;
|
||||
if (hsRef<RelVaultNode> rvnParentLink = VaultGetOwnedAgeLink(&search))
|
||||
|
@ -375,8 +375,8 @@ bool VaultAmCzarOfCurrentAge ();
|
||||
bool VaultAmOwnerOfAge (const plUUID& ageInstId);
|
||||
bool VaultAmCzarOfAge (const plUUID& ageInstId);
|
||||
bool VaultRegisterMTStationAndWait (
|
||||
const wchar_t stationName[],
|
||||
const wchar_t linkBackSpawnPtObjName[]
|
||||
const plString& stationName,
|
||||
const plString& linkBackSpawnPtObjName
|
||||
);
|
||||
void VaultProcessPlayerInbox ();
|
||||
|
||||
@ -402,12 +402,12 @@ hsRef<RelVaultNode> VaultGetAgePublicAgesFolder();
|
||||
hsRef<RelVaultNode> VaultAgeGetBookshelfFolder();
|
||||
hsRef<RelVaultNode> VaultFindAgeSubAgeLink(const plAgeInfoStruct * info);
|
||||
hsRef<RelVaultNode> VaultFindAgeChildAgeLink(const plAgeInfoStruct * info);
|
||||
hsRef<RelVaultNode> VaultFindAgeChronicleEntry(const wchar_t entryName[], int entryType = -1);
|
||||
hsRef<RelVaultNode> VaultFindAgeChronicleEntry(const plString& entryName, int entryType = -1);
|
||||
// if entry of same name and type already exists, value is updated
|
||||
void VaultAddAgeChronicleEntry (
|
||||
const wchar_t entryName[],
|
||||
const plString& entryName,
|
||||
int entryType,
|
||||
const wchar_t entryValue[]
|
||||
const plString& entryValue
|
||||
);
|
||||
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait(const plString& deviceName); // blocks until completion
|
||||
void VaultAgeRemoveDevice (const plString& deviceName);
|
||||
@ -434,11 +434,11 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait (
|
||||
);
|
||||
bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const plUUID& arentUuid);
|
||||
bool VaultAgeFindOrCreateChildAgeLinkAndWait (
|
||||
const wchar_t parentAgeName[], // nil --> current age, non-nil --> owned age by given name
|
||||
const plString& parentAgeName, // nil --> current age, non-nil --> owned age by given name
|
||||
const plAgeInfoStruct * info,
|
||||
plAgeLinkStruct * link
|
||||
);
|
||||
uint8_t VaultAgeFindOrCreateChildAgeLink(const wchar_t parentAgeName[], const plAgeInfoStruct* info, plAgeLinkStruct* link);
|
||||
uint8_t VaultAgeFindOrCreateChildAgeLink(const plString& parentAgeName, const plAgeInfoStruct* info, plAgeLinkStruct* link);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user