diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp index 16d38969..99784a84 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp @@ -336,7 +336,7 @@ PF_CONSOLE_CMD( Net, // groupName "Link to an age." ) // helpString { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); link.SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); plNetLinkingMgr::GetInstance()->LinkToAge( &link ); PrintString("Linking to age..."); @@ -350,7 +350,7 @@ PF_CONSOLE_CMD( Net, // groupName "Link to a specific age by guid." ) // helpString { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); //link.GetAgeInfo()->SetAgeInstanceName( params[0] ); //link.GetAgeInfo()->SetAgeUserDefinedName( params[0] ); plUUID guid( (const char *)params[1] ); @@ -375,7 +375,7 @@ PF_CONSOLE_CMD( Net, "Link to specified age using Original Age Linking Book rules" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); link.SpawnPoint() = plSpawnPointInfo( (const char *)params[1], (const char *)params[1] ); link.SetLinkingRules( plNetCommon::LinkingRules::kOriginalBook ); plNetLinkingMgr::GetInstance()->LinkToAge( &link ); @@ -388,7 +388,7 @@ PF_CONSOLE_CMD( Net, "Link to specified age using Personal Age Linking Book rules" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook ); plNetLinkingMgr::GetInstance()->LinkToAge( &link ); PrintString("Linking to age I own..."); @@ -400,7 +400,7 @@ PF_CONSOLE_CMD( Net, "Link to specified age using Personal Age Linking Book rules" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); link.SetLinkingRules( plNetCommon::LinkingRules::kVisitBook ); plNetLinkingMgr::GetInstance()->LinkToAge( &link ); PrintString("Linking to age I can visit..."); @@ -412,7 +412,7 @@ PF_CONSOLE_CMD( Net, "Link to a sub-age of the current age" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); link.SetLinkingRules( plNetCommon::LinkingRules::kSubAgeBook ); plNetLinkingMgr::GetInstance()->LinkToAge( &link ); PrintString("Linking to a sub-age..."); @@ -481,7 +481,7 @@ PF_CONSOLE_CMD( Net, plNetLinkingMgr * lm = plNetLinkingMgr::GetInstance(); plAgeInfoStruct info; - info.SetAgeFilename( params[0] ); + info.SetAgeFilename( (const char *)params[0] ); plAgeLinkStruct link; if (!VaultGetOwnedAgeLink(&info, &link)) { @@ -806,8 +806,8 @@ PF_CONSOLE_CMD( Net_Vault, "Add an instance of the specified age to your bookshelf" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); - link.GetAgeInfo()->SetAgeInstanceName( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); + link.GetAgeInfo()->SetAgeInstanceName( (const char *)params[0] ); plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.SetSpawnPoint( kDefaultSpawnPoint ); @@ -822,7 +822,7 @@ PF_CONSOLE_CMD( Net_Vault, "Remove the specified age from your bookshelf" ) { plAgeInfoStruct info; - info.SetAgeFilename( params[0] ); + info.SetAgeFilename( (const char *)params[0] ); bool success = VaultUnregisterOwnedAgeAndWait(&info); PrintStringF(PrintString, "Operation %s.", success ? "Successful" : "Failed"); } @@ -834,8 +834,8 @@ PF_CONSOLE_CMD( Net_Vault, "Add an instance of the specified age to your private links" ) { plAgeLinkStruct link; - link.GetAgeInfo()->SetAgeFilename( params[0] ); - link.GetAgeInfo()->SetAgeInstanceName( params[0] ); + link.GetAgeInfo()->SetAgeFilename( (const char *)params[0] ); + link.GetAgeInfo()->SetAgeInstanceName( (const char *)params[0] ); plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid( &guid); link.SetSpawnPoint( kDefaultSpawnPoint ); @@ -850,7 +850,7 @@ PF_CONSOLE_CMD( Net_Vault, "Remove all instances of the specified age from your private links" ) { plAgeInfoStruct info; - info.SetAgeFilename( params[0] ); + info.SetAgeFilename( (const char *)params[0] ); unsigned count = 0; while (VaultUnregisterVisitAgeAndWait(&info)) diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 72a674b0..ef6abde0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -632,7 +632,7 @@ PyObject* cyMisc::GetAgeInfo() } -const char* cyMisc::GetPrevAgeName() +plString cyMisc::GetPrevAgeName() { plNetLinkingMgr* nmgr = plNetLinkingMgr::GetInstance(); if (nmgr) @@ -641,7 +641,7 @@ const char* cyMisc::GetPrevAgeName() if (als) return als->GetAgeInfo()->GetAgeFilename(); } - return nil; + return plString::Null; } PyObject* cyMisc::GetPrevAgeInfo() diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index 6dfa30ce..12180ec3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -300,7 +300,7 @@ public: // static const char* GetAgeName(); static PyObject* GetAgeInfo(); // returns pyAgeInfoStruct - static const char* GetPrevAgeName(); + static plString GetPrevAgeName(); static PyObject* GetPrevAgeInfo(); // current time in current age static uint32_t GetAgeTime( void ); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp index 852c8c31..fa252671 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp @@ -68,7 +68,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAgeTime, "DEPRECIATED - use ptDniInf PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetPrevAgeName, "Returns filename of previous age visited") { - return PyString_FromString(cyMisc::GetPrevAgeName()); + return PyString_FromPlString(cyMisc::GetPrevAgeName()); } PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetPrevAgeInfo, "Returns ptAgeInfoStruct of previous age visited") diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp index 4cdfa0b7..5d9f1440 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp @@ -81,42 +81,42 @@ void pyAgeInfoStruct::CopyFromRef( const pyAgeInfoStructRef & other ) fAgeInfo.CopyFrom( other.GetAgeInfo() ); } -const char * pyAgeInfoStruct::GetAgeFilename() const +plString pyAgeInfoStruct::GetAgeFilename() const { return fAgeInfo.GetAgeFilename(); } -void pyAgeInfoStruct::SetAgeFilename( const char * v ) +void pyAgeInfoStruct::SetAgeFilename( const plString & v ) { fAgeInfo.SetAgeFilename( v ); } -const char * pyAgeInfoStruct::GetAgeInstanceName() const +plString pyAgeInfoStruct::GetAgeInstanceName() const { return fAgeInfo.GetAgeInstanceName(); } -void pyAgeInfoStruct::SetAgeInstanceName( const char * v ) +void pyAgeInfoStruct::SetAgeInstanceName( const plString & v ) { fAgeInfo.SetAgeInstanceName( v ); } -const char * pyAgeInfoStruct::GetAgeUserDefinedName() const +plString pyAgeInfoStruct::GetAgeUserDefinedName() const { return fAgeInfo.GetAgeUserDefinedName(); } -void pyAgeInfoStruct::SetAgeUserDefinedName( const char * v ) +void pyAgeInfoStruct::SetAgeUserDefinedName( const plString & v ) { fAgeInfo.SetAgeUserDefinedName( v ); } -const char * pyAgeInfoStruct::GetAgeDescription() const +plString pyAgeInfoStruct::GetAgeDescription() const { return fAgeInfo.GetAgeDescription(); } -void pyAgeInfoStruct::SetAgeDescription( const char * v ) +void pyAgeInfoStruct::SetAgeDescription( const plString & v ) { fAgeInfo.SetAgeDescription( v ); } @@ -132,12 +132,12 @@ void pyAgeInfoStruct::SetAgeInstanceGuid( const char * guid ) if ( guid[0] == '@' ) { // if it starts with an @ then do a meta kind of GUID - std::string curInst = fAgeInfo.GetAgeInstanceName(); - std::string y = curInst + guid; + plString curInst = fAgeInfo.GetAgeInstanceName(); + plString y = curInst + guid; plMD5Checksum hash; hash.Start(); - hash.AddTo(y.length(), (uint8_t*)y.c_str()); + hash.AddTo(y.GetSize(), (uint8_t*)y.c_str()); hash.Finish(); const char* md5sum = hash.GetAsHexString(); @@ -180,9 +180,9 @@ void pyAgeInfoStruct::SetAgeLanguage( int32_t v ) plString pyAgeInfoStruct::GetDisplayName() const { - const char* instance = GetAgeInstanceName(); - const char* user = GetAgeUserDefinedName(); - bool namesEqual = (stricmp(user, instance) == 0); // Ae'gura Ae'gura + plString instance = GetAgeInstanceName(); + plString user = GetAgeUserDefinedName(); + bool namesEqual = (user.CompareI(instance) == 0); // Ae'gura Ae'gura if (namesEqual) return instance; @@ -190,9 +190,9 @@ plString pyAgeInfoStruct::GetDisplayName() const { int32_t seq = GetAgeSequenceNumber(); if (seq > 0) - return plString::Format("%s (%d) %s", user, seq, instance); + return plString::Format("%s (%d) %s", user.c_str(), seq, instance.c_str()); else - return plString::Format("%s %s", user, instance); + return plString::Format("%s %s", user.c_str(), instance.c_str()); } } @@ -211,32 +211,32 @@ void pyAgeInfoStructRef::CopyFromRef( const pyAgeInfoStructRef & other ) fAgeInfo.CopyFrom( other.GetAgeInfo() ); } -const char * pyAgeInfoStructRef::GetAgeFilename() const +plString pyAgeInfoStructRef::GetAgeFilename() const { return fAgeInfo.GetAgeFilename(); } -void pyAgeInfoStructRef::SetAgeFilename( const char * v ) +void pyAgeInfoStructRef::SetAgeFilename( const plString & v ) { fAgeInfo.SetAgeFilename( v ); } -const char * pyAgeInfoStructRef::GetAgeInstanceName() const +plString pyAgeInfoStructRef::GetAgeInstanceName() const { return fAgeInfo.GetAgeInstanceName(); } -void pyAgeInfoStructRef::SetAgeInstanceName( const char * v ) +void pyAgeInfoStructRef::SetAgeInstanceName( const plString & v ) { fAgeInfo.SetAgeInstanceName( v ); } -const char * pyAgeInfoStructRef::GetAgeUserDefinedName() const +plString pyAgeInfoStructRef::GetAgeUserDefinedName() const { return fAgeInfo.GetAgeUserDefinedName(); } -void pyAgeInfoStructRef::SetAgeUserDefinedName( const char * v ) +void pyAgeInfoStructRef::SetAgeUserDefinedName( const plString & v ) { fAgeInfo.SetAgeUserDefinedName( v ); } @@ -265,9 +265,9 @@ void pyAgeInfoStructRef::SetAgeSequenceNumber( int32_t v ) plString pyAgeInfoStructRef::GetDisplayName() const { - const char* instance = GetAgeInstanceName(); - const char* user = GetAgeUserDefinedName(); - bool namesEqual = (stricmp(user, instance) == 0); // Ae'gura Ae'gura + plString instance = GetAgeInstanceName(); + plString user = GetAgeUserDefinedName(); + bool namesEqual = (user.CompareI(instance) == 0); // Ae'gura Ae'gura if (namesEqual) return instance; @@ -275,8 +275,8 @@ plString pyAgeInfoStructRef::GetDisplayName() const { int32_t seq = GetAgeSequenceNumber(); if (seq > 0) - return plString::Format("%s (%d) %s", user, seq, instance); + return plString::Format("%s (%d) %s", user.c_str(), seq, instance.c_str()); else - return plString::Format("%s %s", user, instance); + return plString::Format("%s %s", user.c_str(), instance.c_str()); } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h index 89a7d302..5eb5f815 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h @@ -87,14 +87,14 @@ public: static void PythonModDef(); void CopyFrom( const pyAgeInfoStruct & other ); void CopyFromRef( const pyAgeInfoStructRef & other ); - const char * GetAgeFilename() const; - void SetAgeFilename( const char * v ); - const char * GetAgeInstanceName() const; - void SetAgeInstanceName( const char * v ); - const char * GetAgeUserDefinedName() const; - void SetAgeUserDefinedName( const char * v ); - const char * GetAgeDescription() const; - void SetAgeDescription( const char * v ); + plString GetAgeFilename() const; + void SetAgeFilename( const plString & v ); + plString GetAgeInstanceName() const; + void SetAgeInstanceName( const plString & v ); + plString GetAgeUserDefinedName() const; + void SetAgeUserDefinedName( const plString & v ); + plString GetAgeDescription() const; + void SetAgeDescription( const plString & v ); const char * GetAgeInstanceGuid() const; void SetAgeInstanceGuid( const char * guid ); int32_t GetAgeSequenceNumber() const; @@ -132,12 +132,12 @@ public: const plAgeInfoStruct * GetAgeInfo() const { return &fAgeInfo; } void CopyFrom( const pyAgeInfoStruct & other ); void CopyFromRef( const pyAgeInfoStructRef & other ); - const char * GetAgeFilename() const; - void SetAgeFilename( const char * v ); - const char * GetAgeInstanceName() const; - void SetAgeInstanceName( const char * v ); - const char * GetAgeUserDefinedName() const; - void SetAgeUserDefinedName( const char * v ); + plString GetAgeFilename() const; + void SetAgeFilename( const plString & v ); + plString GetAgeInstanceName() const; + void SetAgeInstanceName( const plString & v ); + plString GetAgeUserDefinedName() const; + void SetAgeUserDefinedName( const plString & v ); const char * GetAgeInstanceGuid() const; void SetAgeInstanceGuid( const char * guid ); int32_t GetAgeSequenceNumber() const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp index fad2a201..75855e1c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp @@ -115,7 +115,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, copyFrom, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStruct, getAgeFilename) { - return PyString_FromString(self->fThis->GetAgeFilename()); + return PyString_FromPlString(self->fThis->GetAgeFilename()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeFilename, args) @@ -132,7 +132,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeFilename, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStruct, getAgeInstanceName) { - return PyString_FromString(self->fThis->GetAgeInstanceName()); + return PyString_FromPlString(self->fThis->GetAgeInstanceName()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeInstanceName, args) @@ -149,7 +149,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeInstanceName, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStruct, getAgeUserDefinedName) { - return PyString_FromString(self->fThis->GetAgeUserDefinedName()); + return PyString_FromPlString(self->fThis->GetAgeUserDefinedName()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeUserDefinedName, args) @@ -166,7 +166,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeUserDefinedName, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStruct, getAgeDescription) { - return PyString_FromString(self->fThis->GetAgeDescription()); + return PyString_FromPlString(self->fThis->GetAgeDescription()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeDescription, args) @@ -325,7 +325,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, copyFrom, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStructRef, getAgeFilename) { - return PyString_FromString(self->fThis->GetAgeFilename()); + return PyString_FromPlString(self->fThis->GetAgeFilename()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeFilename, args) @@ -342,7 +342,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeFilename, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStructRef, getAgeInstanceName) { - return PyString_FromString(self->fThis->GetAgeInstanceName()); + return PyString_FromPlString(self->fThis->GetAgeInstanceName()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeInstanceName, args) @@ -359,7 +359,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeInstanceName, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStructRef, getAgeUserDefinedName) { - return PyString_FromString(self->fThis->GetAgeUserDefinedName()); + return PyString_FromPlString(self->fThis->GetAgeUserDefinedName()); } PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeUserDefinedName, args) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h index 2af30bf1..32688019 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h @@ -76,9 +76,9 @@ public: plNetServerSessionInfo & ServerInfo() { return fInfo; } - void SetServerName(const char * val) { fInfo.SetServerName( val ); } + void SetServerName(const plString & val) { fInfo.SetServerName( val ); } void SetServerType(uint8_t val) { fInfo.SetServerType( val ); } - void SetServerAddr(const char * val) { fInfo.SetServerAddr( val ); } + void SetServerAddr(const plString & val) { fInfo.SetServerAddr( val ); } void SetServerPort(uint16_t val) { fInfo.SetServerPort( val ); } void SetServerGuid(const char * val) { fServerGuid.FromString( val ); fInfo.SetServerGuid( &fServerGuid ); } bool HasServerName() const { return fInfo.HasServerName(); } @@ -86,9 +86,9 @@ public: bool HasServerAddr() const { return fInfo.HasServerAddr(); } bool HasServerPort() const { return fInfo.HasServerPort(); } bool HasServerGuid() const { return fInfo.HasServerGuid(); } - const char * GetServerName() const { return fInfo.GetServerName(); } + plString GetServerName() const { return fInfo.GetServerName(); } uint8_t GetServerType() const { return fInfo.GetServerType(); } - const char * GetServerAddr() const { return fInfo.GetServerAddr(); } + plString GetServerAddr() const { return fInfo.GetServerAddr(); } uint16_t GetServerPort() const { return fInfo.GetServerPort(); } const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; @@ -116,9 +116,9 @@ public: static void AddPlasmaClasses(PyObject *m); - void SetServerName(const char * val) { fInfo.SetServerName( val ); } + void SetServerName(const plString & val) { fInfo.SetServerName( val ); } void SetServerType(uint8_t val) { fInfo.SetServerType( val ); } - void SetServerAddr(const char * val) { fInfo.SetServerAddr( val ); } + void SetServerAddr(const plString & val) { fInfo.SetServerAddr( val ); } void SetServerPort(uint16_t val) { fInfo.SetServerPort( val ); } void SetServerGuid(const char * val) { fServerGuid.FromString( val ); fInfo.SetServerGuid( &fServerGuid ); } bool HasServerName() const { return fInfo.HasServerName(); } @@ -126,9 +126,9 @@ public: bool HasServerAddr() const { return fInfo.HasServerAddr(); } bool HasServerPort() const { return fInfo.HasServerPort(); } bool HasServerGuid() const { return fInfo.HasServerGuid(); } - const char * GetServerName() const { return fInfo.GetServerName(); } + plString GetServerName() const { return fInfo.GetServerName(); } uint8_t GetServerType() const { return fInfo.GetServerType(); } - const char * GetServerAddr() const { return fInfo.GetServerAddr(); } + plString GetServerAddr() const { return fInfo.GetServerAddr(); } uint16_t GetServerPort() const { return fInfo.GetServerPort(); } const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfoGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfoGlue.cpp index 824e7bc7..b212fecf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfoGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfoGlue.cpp @@ -143,7 +143,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, hasServerGuid) PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, getServerName) { - return PyString_FromString(self->fThis->GetServerName()); + return PyString_FromPlString(self->fThis->GetServerName()); } PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, getServerType) @@ -153,7 +153,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, getServerType) PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, getServerAddr) { - return PyString_FromString(self->fThis->GetServerAddr()); + return PyString_FromPlString(self->fThis->GetServerAddr()); } PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfo, getServerPort) @@ -306,7 +306,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, hasServerGuid) PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, getServerName) { - return PyString_FromString(self->fThis->GetServerName()); + return PyString_FromPlString(self->fThis->GetServerName()); } PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, getServerType) @@ -316,7 +316,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, getServerType) PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, getServerAddr) { - return PyString_FromString(self->fThis->GetServerAddr()); + return PyString_FromPlString(self->fThis->GetServerAddr()); } PYTHON_METHOD_DEFINITION_NOARGS(ptNetServerSessionInfoRef, getServerPort) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index 61b43f39..0beff194 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -671,18 +671,18 @@ void pyVault::CreateNeighborhood() if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') { title = plString::Format( "%s'", nc->GetPlayerName().c_str() ); - desc = plString::Format( "%s' %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); + desc = plString::Format( "%s' %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() ); } else { title = plString::Format( "%s's", nc->GetPlayerName().c_str() ); - desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); + desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() ); } plUUID guid = plUUID::Generate(); link.GetAgeInfo()->SetAgeInstanceGuid(&guid); - link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); - link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); + link.GetAgeInfo()->SetAgeUserDefinedName(title); + link.GetAgeInfo()->SetAgeDescription(desc); VaultRegisterOwnedAge(&link); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h index a7d265ca..abfacd85 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h @@ -118,6 +118,12 @@ unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars, uns unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars); unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars, unsigned codePage); +// FIXME: Get rid of these +inline unsigned StrToUnicode(wchar_t * dest, const plString & source, unsigned destChars) + { return StrToUnicode(dest, source.c_str(), destChars); } +inline unsigned StrToUnicode(wchar_t * dest, const plString & source, unsigned destChars, unsigned codePage) + { return StrToUnicode(dest, source.c_str(), destChars, codePage); } + float StrToFloat (const char source[], const char ** endptr); float StrToFloat (const wchar_t source[], const wchar_t ** endptr); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index 3cc50879..37f4e8f9 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -108,7 +108,6 @@ bool plSceneInputInterface::fShowLOS = false; plSceneInputInterface::plSceneInputInterface() { fPipe = nil; - fSpawnPoint = nil; fAgeInstanceGuid.Clear(); fInstance = this; SetEnabled( true ); // Always enabled @@ -840,11 +839,11 @@ void plSceneInputInterface::ILinkOffereeToAge() unsigned nameLen = plNetClientMgr::GetInstance()->GetPlayerName().GetSize(); if (plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 's' || plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 'S') { title = plString::Format( "%s'", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); - desc = plString::Format( "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); + desc = plString::Format( "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() ); } else { title = plString::Format( "%s's", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); - desc = plString::Format( "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); + desc = plString::Format( "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() ); } info.SetAgeUserDefinedName( title.c_str() ); @@ -869,7 +868,7 @@ void plSceneInputInterface::ILinkOffereeToAge() linkNode->DecRef(); } - if (fSpawnPoint) { + if (!fSpawnPoint.IsEmpty()) { plSpawnPointInfo spawnPoint; spawnPoint.SetName(fSpawnPoint); link.SetSpawnPoint(spawnPoint); @@ -878,12 +877,12 @@ void plSceneInputInterface::ILinkOffereeToAge() // We now own the age, offer it - if (0 == stricmp(fOfferedAgeFile, kPersonalAgeFilename)) + if (fOfferedAgeFile.CompareI(kPersonalAgeFilename) == 0) plNetLinkingMgr::GetInstance()->OfferLinkToPlayer(&link, fOffereeID, fManager->GetKey()); else plNetLinkingMgr::GetInstance()->LinkPlayerToAge(&link, fOffereeID); - if (!fPendingLink && stricmp(fOfferedAgeFile, kPersonalAgeFilename)) + if (!fPendingLink && fOfferedAgeFile.CompareI(kPersonalAgeFilename) != 0) { // tell our local dialog to pop up again... plKey avKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h index fc2fcfd8..72d88ecf 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h @@ -82,10 +82,10 @@ class plSceneInputInterface : public plInputInterface int fBookMode; // are we in offer book mode? plKey fBookKey; // key for the python file modifier for the book we are offering plKey fOffereeKey; - uint32_t fOffereeID; // ID for the guy who's accepted our link offer - const char* fOfferedAgeFile; - const char* fOfferedAgeInstance; - const char* fSpawnPoint; + uint32_t fOffereeID; // ID for the guy who's accepted our link offer + plString fOfferedAgeFile; + plString fOfferedAgeInstance; + plString fSpawnPoint; plUUID fAgeInstanceGuid; struct clickableTest { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h index 16a29ece..90cec7ca 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h @@ -62,9 +62,9 @@ class plInputIfaceMgrMsg : public plMessage uint8_t fCommand; plInputInterface *fInterface; uint32_t fPageID; - const char* ageName; - const char* ageFileName; - const char* spawnPoint; + plString ageName; + plString ageFileName; + plString spawnPoint; plUUID ageInstanceGuid; plKey fAvKey; public: @@ -88,10 +88,10 @@ class plInputIfaceMgrMsg : public plMessage kSetShareAgeInstanceGuid, }; - plInputIfaceMgrMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fInterface = nil; ageName = ageFileName = spawnPoint = 0; fAvKey = nil; } - plInputIfaceMgrMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} - plInputIfaceMgrMsg( uint8_t command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} - plInputIfaceMgrMsg( uint8_t command, uint32_t pageID ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fPageID = pageID; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} + plInputIfaceMgrMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fInterface = nil; fAvKey = nil; } + plInputIfaceMgrMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fInterface = nil; fAvKey = nil; } + plInputIfaceMgrMsg( uint8_t command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fInterface = nil; fAvKey = nil; } + plInputIfaceMgrMsg( uint8_t command, uint32_t pageID ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fPageID = pageID; fInterface = nil; fAvKey = nil; } ~plInputIfaceMgrMsg(); CLASSNAME_REGISTER( plInputIfaceMgrMsg ); @@ -102,9 +102,9 @@ class plInputIfaceMgrMsg : public plMessage plMessage::IMsgRead( s, mgr ); s->ReadLE( &fCommand ); s->ReadLE( &fPageID ); - ageName = s->ReadSafeString(); - ageFileName = s->ReadSafeString(); - spawnPoint = s->ReadSafeString(); + ageName = s->ReadSafeString_TEMP(); + ageFileName = s->ReadSafeString_TEMP(); + spawnPoint = s->ReadSafeString_TEMP(); fAvKey = mgr->ReadKey(s); } @@ -119,18 +119,18 @@ class plInputIfaceMgrMsg : public plMessage mgr->WriteKey(s,fAvKey); } - void SetAgeName(const char* s) { ageName = s; } - const char* GetAgeName() { return ageName; } - void SetAgeFileName(const char* s) { ageFileName = s; } - const char* GetAgeFileName() { return ageFileName; } - void SetSpawnPoint(const char* s) { spawnPoint = s; } - const char* GetSpawnPoint() { return spawnPoint; } + void SetAgeName(const plString& s) { ageName = s; } + plString GetAgeName() const { return ageName; } + void SetAgeFileName(const plString& s) { ageFileName = s; } + plString GetAgeFileName() const { return ageFileName; } + void SetSpawnPoint(const plString& s) { spawnPoint = s; } + plString GetSpawnPoint() const { return spawnPoint; } void SetAgeInstanceGuid(const plUUID& guid) { ageInstanceGuid = guid; } - const plUUID& GetAgeInstanceGuid() { return ageInstanceGuid; } - uint8_t GetCommand( void ) { return fCommand; } - uint32_t GetPageID( void ) { return fPageID; } + const plUUID& GetAgeInstanceGuid() const { return ageInstanceGuid; } + uint8_t GetCommand() const { return fCommand; } + uint32_t GetPageID() const { return fPageID; } void SetIFace( plInputInterface *iface ); - plInputInterface *GetIFace( void ) const { return fInterface; } + plInputInterface *GetIFace() const { return fInterface; } plKey& GetAvKey( void ) { return fAvKey; } const plKey& GetAvKey( void ) const { return fAvKey; } void SetAvKey( plKey& k ) { fAvKey = k; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp index 6cab6095..e5528a6f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp @@ -374,16 +374,16 @@ bool plLinkEffectsMgr::MsgReceive(plMessage *msg) if (linkKey == nc->GetLocalPlayerKey()) { if(lm) { - const char *ageName = lm->GetAgeLink()->GetAgeInfo()->GetAgeFilename(); - const char *prevAgeName = lm->GetPrevAgeLink()->GetAgeInfo()->GetAgeFilename(); + plString ageName = lm->GetAgeLink()->GetAgeInfo()->GetAgeFilename(); + plString prevAgeName = lm->GetPrevAgeLink()->GetAgeInfo()->GetAgeFilename(); - bool linkToStartup = ageName && !stricmp(ageName, kStartUpAgeFilename ); // To Startup - bool linkFromStartup = prevAgeName && !stricmp(prevAgeName, kStartUpAgeFilename); // Leaving Startup + bool linkToStartup = ageName.CompareI(kStartUpAgeFilename) == 0; // To Startup + bool linkFromStartup = prevAgeName.CompareI(kStartUpAgeFilename) == 0; // Leaving Startup bool cleftSolved = VaultHasChronicleEntry( kCleftSolved ); - bool linkToACA = ageName && !stricmp(ageName, kAvCustomizationFilename); - bool linkFromACA = prevAgeName && !stricmp(prevAgeName, kAvCustomizationFilename); + bool linkToACA = ageName.CompareI(kAvCustomizationFilename) == 0; + bool linkFromACA = prevAgeName.CompareI(kAvCustomizationFilename) == 0; bool linkToFissureDrop = lm && lm->GetAgeLink()->HasSpawnPt() && @@ -606,4 +606,4 @@ void plLinkEffectsMgr::IRemovePseudo(plKey avatarKey) } } -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 1dd07572..6e93f451 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -1144,7 +1144,7 @@ bool plNetClientMgr::ObjectInLocalAge(const plSynchedObject* obj) const // // the next age we are going to // -const char* plNetClientMgr::GetNextAgeFilename() +plString plNetClientMgr::GetNextAgeFilename() const { // set when we start linking to an age. plNetLinkingMgr * lm = plNetLinkingMgr::GetInstance(); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h index 4cac0c0f..d7ab4207 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h @@ -358,7 +358,7 @@ public: const plKey& GetAgeSDLObjectKey() const { return fAgeSDLObjectKey; } plUoid GetAgeSDLObjectUoid(const char* ageName) const; plNetClientComm& GetNetClientComm() { return fNetClientComm; } - const char* GetNextAgeFilename(); + plString GetNextAgeFilename() const; void SetOverrideAgeTimeOfDayPercent(float f) { fOverrideAgeTimeOfDayPercent=f; } void AddPendingPagingRoomMsg( plNetMsgPagingRoom * msg ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.cpp index af34573d..0379cbb4 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.cpp @@ -72,7 +72,7 @@ void plNetClientMsgScreener::ICreateStatusLog() const // // return cur age name // -const char* plNetClientMsgScreener::IGetAgeName() const +plString plNetClientMsgScreener::IGetAgeName() const { plNetLinkingMgr *lm = plNetLinkingMgr::GetInstance(); return lm && lm->GetAgeLink()->GetAgeInfo() ? lm->GetAgeLink()->GetAgeInfo()->GetAgeFilename() : "?"; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.h index c449fc2a..cf0044ca 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgScreener.h @@ -52,7 +52,7 @@ class plNetClientMsgScreener : public plNetMsgScreener protected: void ICreateStatusLog() const; const char* IGetSenderName(const plNetGameMember* gm) const { return "local"; } - const char* IGetAgeName() const; + plString IGetAgeName() const; bool IIsLocalAvatarKey(plKey key, const plNetGameMember* gm) const; bool IIsLocalArmatureModKey(plKey key, const plNetGameMember* gm) const; bool IIsSenderCCR(const plNetGameMember* gm=nil) const; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index bd5651ff..ff38afa6 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -436,7 +436,7 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg) joinAgeOp->muteSfx = !msg->PlayLinkInSfx(); StrCopy( joinAgeOp->age.ageDatasetName, - GetAgeLink()->GetAgeInfo()->GetAgeFilename(), + GetAgeLink()->GetAgeInfo()->GetAgeFilename().c_str(), arrsize(joinAgeOp->age.ageDatasetName) ); StrCopy( @@ -775,9 +775,9 @@ void plNetLinkingMgr::IPostProcessLink( void ) plAgeLinkStruct* link = GetAgeLink(); plAgeInfoStruct* info = link->GetAgeInfo(); - bool city = (stricmp(info->GetAgeFilename(), kCityAgeFilename) == 0); - bool hood = (stricmp(info->GetAgeFilename(), kNeighborhoodAgeFilename) == 0); - bool psnl = (stricmp(info->GetAgeFilename(), kPersonalAgeFilename) == 0); + bool city = (info->GetAgeFilename().CompareI(kCityAgeFilename) == 0); + bool hood = (info->GetAgeFilename().CompareI(kNeighborhoodAgeFilename) == 0); + bool psnl = (info->GetAgeFilename().CompareI(kPersonalAgeFilename) == 0); // Update our online status if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) { @@ -913,17 +913,17 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) //------------------------------------------------------------------------ // SPECIAL CASE: StartUp: force basic link - if (stricmp(info->GetAgeFilename(), kStartUpAgeFilename) == 0) + if (info->GetAgeFilename().CompareI(kStartUpAgeFilename) == 0) link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); //------------------------------------------------------------------------ // SPECIAL CASE: Nexus: force original link - if (stricmp(info->GetAgeFilename(), kNexusAgeFilename) == 0) + if (info->GetAgeFilename().CompareI(kNexusAgeFilename) == 0) link->SetLinkingRules(plNetCommon::LinkingRules::kOriginalBook); //------------------------------------------------------------------------ // SPECIAL CASE: ACA: force original link - if (stricmp(info->GetAgeFilename(), kAvCustomizationFilename ) == 0) + if (info->GetAgeFilename().CompareI(kAvCustomizationFilename) == 0) link->SetLinkingRules(plNetCommon::LinkingRules::kOriginalBook); hsLogEntry(nc->DebugMsg("plNetLinkingMgr: Process: Linking with %s rules...", @@ -970,9 +970,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) plString desc; unsigned nameLen = nc->GetPlayerName().GetSize(); if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') - desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); + desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str()); else - desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); + desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str()); info->SetAgeDescription(desc.c_str()); } if (!info->HasAgeInstanceGuid()) { @@ -1010,9 +1010,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) plString desc; unsigned nameLen = nc->GetPlayerName().GetSize(); if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') - desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); + desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str()); else - desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); + desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str()); info->SetAgeDescription( desc.c_str() ); } @@ -1029,7 +1029,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) } } else { - if (stricmp(info->GetAgeFilename(), kNeighborhoodAgeFilename) == 0) { + if (info->GetAgeFilename().CompareI(kNeighborhoodAgeFilename) == 0) { // if we get here then it's because we're linking to a neighborhood that we don't belong to // and our own neighborhood book is not volatile, so really we want to basic link link->SetLinkingRules(plNetCommon::LinkingRules::kBasicLink); diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp index a5e575a8..af107476 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp @@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void plNetMsgScreener::IRejectLogMsg(int16_t classIndex, const char* desc, const plNetGameMember* gm) const { DebugMsg("Message %s was rejected, reason:%s, age:%s, client:%s", - plFactory::GetNameOfClass(classIndex), desc, IGetAgeName(), IGetSenderName(gm)); + plFactory::GetNameOfClass(classIndex), desc, IGetAgeName().c_str(), IGetSenderName(gm)); } // @@ -80,7 +80,7 @@ void plNetMsgScreener::IRejectLogMsg(const plMessage* msg, const char* desc, con const char* rcvrName = msg->GetNumReceivers() && msg->GetReceiver(0) ? msg->GetReceiver(0)->GetUoid().GetObjectName().c_str() : "?"; DebugMsg("Message %s was rejected, reason:%s, age:%s, client:%s, msgSndr:%s, msgRcvr:%s", - msg->ClassName(), desc, IGetAgeName(), IGetSenderName(gm), + msg->ClassName(), desc, IGetAgeName().c_str(), IGetSenderName(gm), senderName, rcvrName); } diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h index cee32efa..14ee203c 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h @@ -63,7 +63,7 @@ protected: kYes }; virtual const char* IGetSenderName(const plNetGameMember* gm) const = 0; - virtual const char* IGetAgeName() const = 0; + virtual plString IGetAgeName() const = 0; virtual bool IIsSenderCCR(const plNetGameMember* gm=nil) const = 0; virtual bool IIsLocalAvatarKey(plKey key, const plNetGameMember* gm) const = 0; virtual bool IIsLocalArmatureModKey(plKey key, const plNetGameMember* gm) const { return true; } diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp index 79c9f8bb..6c89a5cf 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetCommon.h" #include "plVault/plVault.h" -#define SAFE(s) ((s)?(s):"(nil)") +#define SAFE(s) ((s).IsEmpty() ? "(nil)" : (s)) #define kComma "," #define kEmpty "" #define kSemicolon ";" @@ -119,11 +119,11 @@ bool plAgeInfoStruct::IsEqualTo( const plAgeInfoStruct * other ) const // otherwise compare everything. bool match = true; if (match && HasAgeFilename() && other->HasAgeFilename()) - match = match && ( stricmp( GetAgeFilename(), other->GetAgeFilename() )==0 ); + match = match && ( GetAgeFilename().CompareI( other->GetAgeFilename() )==0 ); if (match && HasAgeInstanceName() && other->HasAgeInstanceName()) - match = match && ( stricmp( GetAgeInstanceName(), other->GetAgeInstanceName() )==0 ); + match = match && ( GetAgeInstanceName().CompareI( other->GetAgeInstanceName() )==0 ); if (match && HasAgeUserDefinedName() && other->HasAgeUserDefinedName()) - match = match && ( stricmp( GetAgeUserDefinedName(), other->GetAgeUserDefinedName() )==0 ); + match = match && ( GetAgeUserDefinedName().CompareI( other->GetAgeUserDefinedName() )==0 ); if (match && HasAgeSequenceNumber() && other->HasAgeSequenceNumber()) match = match && fAgeSequenceNumber==other->GetAgeSequenceNumber(); if (match && HasAgeLanguage() && other->HasAgeLanguage()) @@ -238,9 +238,9 @@ plString plAgeInfoStruct::AsString() const } -void plAgeInfoStruct::SetAgeFilename( const char * v ) +void plAgeInfoStruct::SetAgeFilename( const plString & v ) { - if ( v && v[0]) + if (!v.IsEmpty()) { SetFlag( kHasAgeFilename ); fAgeFilename=v; @@ -251,9 +251,9 @@ void plAgeInfoStruct::SetAgeFilename( const char * v ) } } -void plAgeInfoStruct::SetAgeInstanceName( const char * v ) +void plAgeInfoStruct::SetAgeInstanceName( const plString & v ) { - if ( v && v[0]) + if (!v.IsEmpty()) { SetFlag( kHasAgeInstanceName ); fAgeInstanceName=v; @@ -278,9 +278,9 @@ void plAgeInfoStruct::SetAgeInstanceGuid( const plUUID * v ) } } -void plAgeInfoStruct::SetAgeUserDefinedName( const char * v ) +void plAgeInfoStruct::SetAgeUserDefinedName( const plString & v ) { - if ( v && v[0]) + if (!v.IsEmpty()) { SetFlag( kHasAgeUserDefinedName ); fAgeUserDefinedName=v; @@ -304,9 +304,9 @@ void plAgeInfoStruct::SetAgeSequenceNumber( uint32_t v ) } } -void plAgeInfoStruct::SetAgeDescription( const char * v ) +void plAgeInfoStruct::SetAgeDescription( const plString & v ) { - if ( v && v[0]) + if (!v.IsEmpty()) { SetFlag( kHasAgeDescription ); fAgeDescription=v; @@ -332,12 +332,12 @@ void plAgeInfoStruct::SetAgeLanguage( uint32_t v ) void plAgeInfoStruct::UpdateFlags() const { - SetFlag( kHasAgeFilename, fAgeFilename.size()!=0 ); - SetFlag( kHasAgeInstanceName, fAgeInstanceName.size()!=0 ); - SetFlag( kHasAgeUserDefinedName, fAgeUserDefinedName.size()!=0 ); + SetFlag( kHasAgeFilename, !fAgeFilename.IsEmpty() ); + SetFlag( kHasAgeInstanceName, !fAgeInstanceName.IsEmpty() ); + SetFlag( kHasAgeUserDefinedName, !fAgeUserDefinedName.IsEmpty() ); SetFlag( kHasAgeInstanceGuid, fAgeInstanceGuid.IsSet() ); SetFlag( kHasAgeSequenceNumber, fAgeSequenceNumber!=0 ); - SetFlag( kHasAgeDescription, fAgeDescription.size()!=0 ); + SetFlag( kHasAgeDescription, !fAgeDescription.IsEmpty() ); SetFlag( kHasAgeLanguage, fAgeLanguage>=0 ); } @@ -622,7 +622,7 @@ plString plNetServerSessionInfo::AsString() const { ss << spacer << "N:" - << SAFE(fServerName.c_str()); + << SAFE(fServerName); spacer = kComma; } if (HasServerGuid()) @@ -636,7 +636,7 @@ plString plNetServerSessionInfo::AsString() const { ss << spacer << "A:[" - << SAFE(fServerAddr.c_str()) + << SAFE(fServerAddr) << ":" << fServerPort << "]"; @@ -662,14 +662,14 @@ plString plNetServerSessionInfo::AsLogString() const if (HasServerName()) { ss << typeName << "Name" << "="; - ss << fServerName.c_str(); + ss << fServerName; ss << spacer; } if (HasServerAddr()) { ss << typeName << "Addr" << "="; - ss << fServerAddr.c_str(); + ss << fServerAddr; ss << spacer; } @@ -696,27 +696,26 @@ bool plNetServerSessionInfo::IsEqualTo(const plNetServerSessionInfo * other) con if (match && IsFlagSet(kHasServerGuid) && other->IsFlagSet(kHasServerGuid)) match = match && fServerGuid.IsEqualTo(other->GetServerGuid()); if (match && IsFlagSet(kHasServerName) && other->IsFlagSet(kHasServerName)) - match = match && (stricmp(fServerName.c_str(),other->fServerName.c_str())==0); + match = match && (fServerName.CompareI(other->fServerName)==0); if (match && IsFlagSet(kHasServerType) && other->IsFlagSet(kHasServerType)) match = match && fServerType==other->fServerType; if (match && IsFlagSet(kHasServerAddr) && other->IsFlagSet(kHasServerAddr)) - match = match && (stricmp(fServerAddr.c_str(),other->fServerAddr.c_str())==0); + match = match && (fServerAddr.CompareI(other->fServerAddr)==0); if (match && IsFlagSet(kHasServerPort) && other->IsFlagSet(kHasServerPort)) match = match && fServerPort==other->fServerPort; return match; } -void plNetServerSessionInfo::SetServerName(const char * val) +void plNetServerSessionInfo::SetServerName(const plString & val) { - if (val) + fServerName = val; + if (!val.IsEmpty()) { - fServerName=val; SetFlag(kHasServerName); } else { - fServerName=""; ClearFlag(kHasServerName); } } @@ -735,16 +734,15 @@ void plNetServerSessionInfo::SetServerType(uint8_t val) } } -void plNetServerSessionInfo::SetServerAddr(const char * val) +void plNetServerSessionInfo::SetServerAddr(const plString & val) { - if (val) + fServerAddr = val; + if (!val.IsEmpty()) { - fServerAddr = val; SetFlag(kHasServerAddr); } else { - fServerAddr = ""; ClearFlag(kHasServerAddr); } } diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h index 43a68608..7812b1c7 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h @@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plNetServerSessionInfo_h_inc #include "HeadSpin.h" -#include #include "pnFactory/plCreatable.h" #include "pnNetCommon/plNetServers.h" @@ -64,19 +63,19 @@ class plAgeInfoStruct : public plCreatable mutable uint8_t fFlags; // Age dataset name "Neighborhood" - std::string fAgeFilename; + plString fAgeFilename; // Age string ID "Bevin" - std::string fAgeInstanceName; + plString fAgeInstanceName; // Age guid. Same as game server guid. plUUID fAgeInstanceGuid; // User-defined age name: "My Teledahn" - std::string fAgeUserDefinedName; + plString fAgeUserDefinedName; // User-defined age description "This is Joe's Neighborhood" - std::string fAgeDescription; + plString fAgeDescription; // A modifier to user-defined name to make it unique in gui lists. // Assigned by vault server. @@ -117,19 +116,19 @@ public: void CopyFrom(const struct NetAgeInfo & info); bool IsEqualTo( const plAgeInfoStruct * other ) const; - const char * GetAgeFilename() const { return fAgeFilename.c_str(); } - const char * GetAgeInstanceName() const { return fAgeInstanceName.c_str(); } + plString GetAgeFilename() const { return fAgeFilename; } + plString GetAgeInstanceName() const { return fAgeInstanceName; } const plUUID * GetAgeInstanceGuid() const { return &fAgeInstanceGuid; } - const char * GetAgeUserDefinedName() const { return fAgeUserDefinedName.c_str(); } - const char * GetAgeDescription() const { return fAgeDescription.c_str(); } + plString GetAgeUserDefinedName() const { return fAgeUserDefinedName; } + plString GetAgeDescription() const { return fAgeDescription; } uint32_t GetAgeSequenceNumber() const { return fAgeSequenceNumber; } uint32_t GetAgeLanguage() const { return fAgeLanguage; } - void SetAgeFilename( const char * v ); - void SetAgeInstanceName( const char * v ); + void SetAgeFilename( const plString & v ); + void SetAgeInstanceName( const plString & v ); void SetAgeInstanceGuid( const plUUID * v ); - void SetAgeUserDefinedName( const char * v ); - void SetAgeDescription( const char * v ); + void SetAgeUserDefinedName( const plString & v ); + void SetAgeDescription( const plString & v ); void SetAgeSequenceNumber( uint32_t v ); void SetAgeLanguage( uint32_t v ); @@ -227,12 +226,12 @@ public: class plNetServerSessionInfo : public plCreatable { - uint8_t fFlags; - std::string fServerName; - uint8_t fServerType; - std::string fServerAddr; - uint16_t fServerPort; - plUUID fServerGuid; + uint8_t fFlags; + plString fServerName; + uint8_t fServerType; + plString fServerAddr; + uint16_t fServerPort; + plUUID fServerGuid; enum { @@ -256,17 +255,17 @@ public: CLASSNAME_REGISTER( plNetServerSessionInfo ); GETINTERFACE_ANY( plNetServerSessionInfo, plCreatable ); - void SetServerName(const char * val); + void SetServerName(const plString & val); void SetServerType(uint8_t val); - void SetServerAddr(const char * val); + void SetServerAddr(const plString & val); void SetServerPort(uint16_t val); void SetServerGuid(const plUUID * val); void CopyServerGuid(const plUUID & val); - const char * GetServerName() const { return fServerName.c_str();} - uint8_t GetServerType() const { return fServerType;} - const char * GetServerAddr() const { return fServerAddr.c_str(); } - uint16_t GetServerPort() const { return fServerPort; } + plString GetServerName() const { return fServerName; } + uint8_t GetServerType() const { return fServerType; } + plString GetServerAddr() const { return fServerAddr; } + uint16_t GetServerPort() const { return fServerPort; } const plUUID *GetServerGuid() const { return &fServerGuid; } plUUID * GetServerGuid() { return &fServerGuid; } diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index 35f8c5a1..e3ab47ac 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -5001,9 +5001,8 @@ uint8_t VaultAgeFindOrCreateChildAgeLink( // Still here? Try to find the Child Ages folder uint8_t retval = hsFail; if (RelVaultNode* rvnChildAges = rvnParentInfo->GetChildAgeInfoListNodeIncRef(plVault::kChildAgesFolder, 1)) { - const char* ageName = info->GetAgeFilename(); wchar_t hack[MAX_PATH]; - StrToUnicode(hack, ageName, arrsize(hack)); + StrToUnicode(hack, info->GetAgeFilename(), arrsize(hack)); // Search for our age NetVaultNode* temp = new NetVaultNode;