diff --git a/Sources/Plasma/CoreLib/hsStream.h b/Sources/Plasma/CoreLib/hsStream.h index 6e0bfdeb..32b390d6 100644 --- a/Sources/Plasma/CoreLib/hsStream.h +++ b/Sources/Plasma/CoreLib/hsStream.h @@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTypes.h" #include "hsMemory.h" +#include "plString.h" namespace hsPackFileSys { struct FileEntry; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp index 84a5dec3..d7aa3e49 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp @@ -117,7 +117,7 @@ void pyAgeInfoStruct::SetAgeDescription( const char * v ) const char * pyAgeInfoStruct::GetAgeInstanceGuid() const { - fAgeInstanceGuidStr = fAgeInfo.GetAgeInstanceGuid()->AsStdString(); + fAgeInstanceGuidStr = fAgeInfo.GetAgeInstanceGuid()->AsString(); return fAgeInstanceGuidStr.c_str(); } @@ -161,9 +161,9 @@ const char * pyAgeInfoStruct::GetDisplayName() const { Int32 seq = GetAgeSequenceNumber(); if ( seq>0 ) - xtl::format( fDisplayName, "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); + fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); else - xtl::format( fDisplayName, "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); + fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); return fDisplayName.c_str(); } @@ -214,7 +214,7 @@ void pyAgeInfoStructRef::SetAgeUserDefinedName( const char * v ) const char * pyAgeInfoStructRef::GetAgeInstanceGuid() const { - fAgeInstanceGuidStr = fAgeInfo.GetAgeInstanceGuid()->AsStdString(); + fAgeInstanceGuidStr = fAgeInfo.GetAgeInstanceGuid()->AsString(); return fAgeInstanceGuidStr.c_str(); } @@ -237,8 +237,8 @@ const char * pyAgeInfoStructRef::GetDisplayName() const { Int32 seq = GetAgeSequenceNumber(); if ( seq>0 ) - xtl::format( fDisplayName, "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); + fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); else - xtl::format( fDisplayName, "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); + fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); return fDisplayName.c_str(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h index 73ec698b..37834c5b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h @@ -57,14 +57,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class pyVaultAgeInfoNode; class pyAgeInfoStructRef; +class plString; class pyAgeInfoStruct { private: plAgeInfoStruct fAgeInfo; - mutable std::string fAgeInstanceGuidStr; // for getting Age Instance GUID - mutable std::string fDisplayName; // used by GetDisplayName() + mutable plString fAgeInstanceGuidStr; // for getting Age Instance GUID + mutable plString fDisplayName; // used by GetDisplayName() protected: pyAgeInfoStruct(); @@ -112,8 +113,8 @@ private: static plAgeInfoStruct fDefaultAgeInfo; // created so a default constructor could be made for python. Do NOT use plAgeInfoStruct & fAgeInfo; - mutable std::string fAgeInstanceGuidStr; // for getting Age Instance GUID - mutable std::string fDisplayName; // used by GetDisplayName() + mutable plString fAgeInstanceGuidStr; // for getting Age Instance GUID + mutable plString fDisplayName; // used by GetDisplayName() protected: pyAgeInfoStructRef(): fAgeInfo( fDefaultAgeInfo ) {} // only here for the python glue... do NOT call directly diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h index f6320204..ebe01c10 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h @@ -92,7 +92,7 @@ public: UInt8 GetServerType() const { return fInfo.GetServerType(); } const char * GetServerAddr() const { return fInfo.GetServerAddr(); } UInt16 GetServerPort() const { return fInfo.GetServerPort(); } - const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString(); } + const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; @@ -132,7 +132,7 @@ public: UInt8 GetServerType() const { return fInfo.GetServerType(); } const char * GetServerAddr() const { return fInfo.GetServerAddr(); } UInt16 GetServerPort() const { return fInfo.GetServerPort(); } - const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString(); } + const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp index cc4177e6..86b7abff 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp @@ -256,6 +256,18 @@ int plMsgStdStringHelper::PokeBig(const char * buf, UInt32 bufsz, hsStream* stre return stream->GetPosition(); } +int plMsgStdStringHelper::Poke(const plString & stringref, hsStream* stream, const UInt32 peekOptions) +{ + std::string temp = stringref.c_str(); + return Poke(temp, stream, peekOptions); +} + +int plMsgStdStringHelper::PokeBig(const plString & stringref, hsStream* stream, const UInt32 peekOptions) +{ + std::string temp = stringref.c_str(); + return PokeBig(temp, stream, peekOptions); +} + // STATIC int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions) { @@ -301,6 +313,22 @@ int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, co return stream->GetPosition(); } +int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions) +{ + std::string temp; + int pos = Peek(temp, stream, peekOptions); + stringref = plString::FromIso8859_1(temp.c_str(), temp.size()); + return pos; +} + +int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions) +{ + std::string temp; + int pos = PeekBig(temp, stream, peekOptions); + stringref = plString::FromIso8859_1(temp.c_str(), temp.size()); + return pos; +} + ///////////////////////////////////////////////////////////////// // STATIC diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h index b5b31709..6a53a8d0 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h @@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plKey; class hsStream; +class plString; // Base class for messages only has enough info to route it // and send it over the wire (Read/Write). @@ -171,8 +172,12 @@ struct plMsgStdStringHelper static int PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); static int Poke(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); static int PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const plString & stringref, hsStream* stream, const UInt32 peekOptions=0); + static int PokeBig(const plString & stringref, hsStream* stream, const UInt32 peekOptions=0); static int Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); static int PeekBig(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); + static int Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions=0); + static int PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions=0); }; ///////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp index f6c6073e..b447b508 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp @@ -47,6 +47,11 @@ plUUID::plUUID() Clear(); } +plUUID::plUUID( const plString & s ) +{ + FromString( s ); +} + plUUID::plUUID( const char * s ) { FromString( s ); @@ -68,8 +73,8 @@ void plUUID::Write( hsStream * s) s->Write( sizeof( fData ), (const void*)fData ); } -const char * plUUID::AsString() const { - static std::string str; - ToStdString(str); - return str.c_str(); +plString plUUID::AsString() const { + plString str; + ToString(str); + return str; } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index 7d1a21af..4a580b0c 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -64,6 +64,7 @@ public: plUUID(); plUUID( const char * s ); + plUUID( const plString & s ); plUUID( const plUUID & other ); #ifdef HS_BUILD_FOR_WIN32 plUUID( const Uuid & uuid ); @@ -76,12 +77,12 @@ public: int CompareTo( const plUUID * v ) const; bool IsEqualTo( const plUUID * v ) const; bool FromString( const char * str ); - bool ToStdString( std::string & out ) const; - inline std::string AsStdString() const { return AsString(); } - const char * AsString() const; // returns static buffer + bool FromString( const plString & str ); + bool ToString( plString & out ) const; + plString AsString() const; void Read( hsStream * s ); void Write( hsStream * s ); - operator std::string ( void ) const { return AsStdString();} + operator plString ( void ) const { return AsString();} bool operator==( const plUUID & other ) const { return IsEqualTo( &other ); } bool operator!=( const plUUID & other ) const { return !IsEqualTo( &other ); } int operator <( const plUUID & other ) const { return CompareTo( &other ); } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp index 47fcde9e..dce63a21 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp @@ -101,15 +101,20 @@ bool plUUID::FromString( const char * str ) return RPC_S_OK == UuidFromString( (unsigned char *)str, (GUID *)this ); } -bool plUUID::ToStdString( std::string & out ) const +bool plUUID::FromString( const plString & str ) { - out = ""; + return FromString( str.c_str() ); +} + +bool plUUID::ToString( plString & out ) const +{ + out = _TEMP_CONVERT_FROM_LITERAL(""); unsigned char * ubuf; RPC_STATUS s; s = UuidToString( (GUID *) this, &ubuf ); bool success = ( s==RPC_S_OK ); if ( success ) - out = (char*)ubuf; + out = plString::FromIso8859_1( (char*)ubuf ); RpcStringFree( &ubuf ); return success; } diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp index ffc45360..e5d86f59 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp @@ -41,7 +41,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plClientGuid.h" #include "hsStream.h" -#include #include "plNetCommon.h" #include "pnMessage/plMessage.h" #include "plSockets/plNet.h" @@ -105,10 +104,10 @@ void plClientGuid::SetTempPlayerID(UInt32 id) } } -void plClientGuid::SetPlayerName( const char * v ) +void plClientGuid::SetPlayerName( const plString & v ) { - fPlayerName = v?v:""; - if ( fPlayerName.size() ) + fPlayerName = v; + if ( !fPlayerName.IsEmpty() ) fFlags|=kPlayerName; else fFlags&=~kPlayerName; @@ -155,10 +154,10 @@ void plClientGuid::SetReserved(bool b) fFlags |= kReserved; } -void plClientGuid::SetClientKey(const std::string& key) +void plClientGuid::SetClientKey(const plString& key) { fClientKey = key; - if ( fClientKey.size() ) + if ( !fClientKey.IsEmpty() ) fFlags|=kClientKey; else fFlags&=~kClientKey; @@ -171,13 +170,13 @@ const char * plClientGuid::GetSrcAddrStr() const return foo; } -std::string plClientGuid::AsStdString() const +plString plClientGuid::AsString() const { #define kComma "," #define kEmpty "" const char * spacer = kEmpty; - std::stringstream ss; + plStringStream ss; ss << "["; @@ -222,7 +221,7 @@ std::string plClientGuid::AsStdString() const } if (IsFlagSet(kAccountUUID)) { - ss << spacer << "plUUID:" << fAccountUUID.AsStdString(); + ss << spacer << "plUUID:" << fAccountUUID.AsString(); spacer = kComma; } if ( IsFlagSet(kReserved)) @@ -237,19 +236,19 @@ std::string plClientGuid::AsStdString() const } ss << "]"; - return ss.str().c_str(); + return ss.GetString(); } -std::string plClientGuid::AsLogString() const +plString plClientGuid::AsLogString() const { #define kSemicolon ";" const char* spacer = kSemicolon; - std::stringstream ss; + plStringStream ss; if (IsFlagSet(kAccountUUID)) { - ss << "AcctUUID=" << fAccountUUID.AsStdString(); + ss << "AcctUUID=" << fAccountUUID.AsString(); ss << spacer; } if (IsFlagSet(kPlayerID)) @@ -298,7 +297,7 @@ std::string plClientGuid::AsLogString() const ss << spacer; } - return ss.str().c_str(); + return ss.GetString(); } void plClientGuid::Read(hsStream * s, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h index 9e04b5d0..b1a3e860 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h @@ -55,11 +55,11 @@ class plClientGuid : public plCreatable UInt8 fCCRLevel; bool fProtectedLogin; UInt8 fBuildType; // see plNetCommon.h - std::string fPlayerName; + plString fPlayerName; UInt32 fSrcAddr; UInt16 fSrcPort; bool fReserved; - std::string fClientKey; + plString fClientKey; public: enum Flags // 16 bits. @@ -80,8 +80,8 @@ public: CLASSNAME_REGISTER( plClientGuid ); GETINTERFACE_ANY( plClientGuid, plCreatable ); - std::string AsStdString() const; - std::string AsLogString() const; + plString AsString() const; + plString AsLogString() const; void Clear(); void CopyFrom(const plClientGuid * other); void UpdateFrom(const plClientGuid * other); @@ -94,7 +94,7 @@ public: bool HasAccountUUID() const { return (fFlags&kAccountUUID&&!fAccountUUID.IsNull())?true:false;} bool HasPlayerID() const { return (fFlags&kPlayerID&&fPlayerID>0)?true:false;} - bool HasPlayerName() const { return (fFlags&kPlayerName&&fPlayerName.size())?true:false; } + bool HasPlayerName() const { return (fFlags&kPlayerName&&!fPlayerName.IsEmpty())?true:false; } bool HasCCRLevel() const { return (fFlags&kCCRLevel)?true:false;} bool HasProtectedLogin() const { return (fFlags&kProtectedLogin)?true:false;} bool HasBuildType() const { return (fFlags&kBuildType)?true:false;} @@ -105,7 +105,7 @@ public: const plUUID * GetAccountUUID() const { return &fAccountUUID;} UInt32 GetPlayerID() const { return fPlayerID;} - const char * GetPlayerName() const { return fPlayerName.c_str(); } + const plString & GetPlayerName() const { return fPlayerName; } UInt8 GetCCRLevel() const { return fCCRLevel; } bool GetProtectedLogin() const { return ( fProtectedLogin!=0 ); } UInt8 GetFlags() const { return (UInt8)fFlags;} @@ -114,12 +114,12 @@ public: const char * GetSrcAddrStr() const; UInt16 GetSrcPort() const { return fSrcPort; } bool IsReserved() const { return fReserved!=0; } - const std::string& GetClientKey() const { return fClientKey; } + const plString& GetClientKey() const { return fClientKey; } void SetAccountUUID(const plUUID * v); void SetAccountUUID(const plUUID & v); void SetPlayerID(UInt32 v); - void SetPlayerName( const char * v ); + void SetPlayerName( const plString & v ); void SetCCRLevel(UInt8 v); void SetProtectedLogin(bool v); void SetBuildType(UInt8 v); @@ -127,7 +127,7 @@ public: void SetSrcAddrFromStr( const char * s ); void SetSrcPort( UInt16 v ); void SetReserved( bool v ); - void SetClientKey( const std::string& key ); + void SetClientKey( const plString& key ); // When a client hasn't selected a player yet, // we need to uniquely identify them in the lobby server. // We do this by stuffing a temp value into the fPlayerID diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp index acadfe3f..01ced3e2 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp @@ -47,8 +47,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetCommon.h" #include "plVault/plVault.h" -#include - #define SAFE(s) ((s)?(s):"(nil)") #define kComma "," #define kEmpty "" @@ -177,11 +175,11 @@ void plAgeInfoStruct::CopyFrom(const NetAgeInfo & info) { } //============================================================================ -std::string plAgeInfoStruct::AsStdString() const +plString plAgeInfoStruct::AsString() const { const char * spacer = kEmpty; - std::stringstream ss; + plStringStream ss; ss << "["; @@ -236,7 +234,7 @@ std::string plAgeInfoStruct::AsStdString() const } ss << "]"; - return ss.str().c_str(); + return ss.GetString(); } @@ -495,11 +493,11 @@ void plAgeLinkStruct::Clear() fAmCCR = false; } -std::string plAgeLinkStruct::AsStdString() const +plString plAgeLinkStruct::AsString() const { const char * spacer = kEmpty; - std::stringstream ss; + plStringStream ss; ss << "["; @@ -507,7 +505,7 @@ std::string plAgeLinkStruct::AsStdString() const { ss << spacer << "Nfo:" - << fAgeInfo.AsStdString(); + << fAgeInfo.AsString(); spacer = kComma; } if (HasLinkingRules()) @@ -533,7 +531,7 @@ std::string plAgeLinkStruct::AsStdString() const } ss << "]"; - return ss.str().c_str(); + return ss.GetString(); } @@ -615,11 +613,11 @@ void plNetServerSessionInfo::CopyFrom(const plNetServerSessionInfo * other) } } -std::string plNetServerSessionInfo::AsStdString() const +plString plNetServerSessionInfo::AsString() const { const char * spacer = kEmpty; - std::stringstream ss; + plStringStream ss; ss << "["; @@ -656,19 +654,19 @@ std::string plNetServerSessionInfo::AsStdString() const } ss << "]"; - return ss.str().c_str(); + return ss.GetString(); } -std::string plNetServerSessionInfo::AsLogString() const +plString plNetServerSessionInfo::AsLogString() const { const char* spacer = kSemicolon; - std::stringstream ss; - std::string typeName = ""; + plStringStream ss; + plString typeName = _TEMP_CONVERT_FROM_LITERAL(""); if (HasServerType()) { - typeName = plNetServerConstants::GetServerTypeStr(fServerType); + typeName = _TEMP_CONVERT_FROM_LITERAL(plNetServerConstants::GetServerTypeStr(fServerType)); } if (HasServerName()) @@ -699,7 +697,7 @@ std::string plNetServerSessionInfo::AsLogString() const ss << spacer; } - return ss.str().c_str(); + return ss.GetString(); } bool plNetServerSessionInfo::IsEqualTo(const plNetServerSessionInfo * other) const diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h index 6a31d56d..e1708f42 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h @@ -147,7 +147,7 @@ public: const char * GetDisplayName() const; - std::string AsStdString() const; + plString AsString() const; }; //////////////////////////////////////////////////////////////////// @@ -220,7 +220,7 @@ public: void Read( hsStream * s, hsResMgr* ); void Write( hsStream * s, hsResMgr* ); - std::string AsStdString() const; + plString AsString() const; }; @@ -291,8 +291,8 @@ public: void Clear(); void CopyFrom(const plNetServerSessionInfo * other); bool IsEqualTo(const plNetServerSessionInfo * other) const; - virtual std::string AsStdString() const; - virtual std::string AsLogString() const; + virtual plString AsString() const; + virtual plString AsLogString() const; void Read(hsStream* s, hsResMgr* mgr=nil); void Write(hsStream* s, hsResMgr* mgr=nil); diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp index ea91c3b7..13f08f47 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp @@ -700,19 +700,12 @@ void plNetMsgStreamedObject::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////////////////// // debug -std::string plNetMsgSDLState::AsStdString() const +plString plNetMsgSDLState::AsString() const { - std::string s; - ISetDescName(); // set desc name for debug if necessary -// xtl::format(s,"object:%s, SDL:%s, initial:%d, %s", -// ObjectInfo()->GetObjectName(), fDescName.c_str(), fIsInitialState, plNetMsgStreamedObject::AsStdString().c_str() ); - - xtl::format(s,"object:%s, initial:%d, %s", - ObjectInfo()->GetObjectName(), fIsInitialState, plNetMsgStreamedObject::AsStdString().c_str() ); - - return s; + return plString::Format("object:%s, initial:%d, %s", + ObjectInfo()->GetObjectName(), fIsInitialState, plNetMsgStreamedObject::AsString().c_str() ); } // @@ -1119,7 +1112,7 @@ int plNetMsgMemberUpdate::IPokeBuffer(hsStream* stream, UInt32 peekOptions) if (bytes) { // FIX ME to something nice - fMemberInfo.GetClientGuid()->SetClientKey(""); + fMemberInfo.GetClientGuid()->SetClientKey(_TEMP_CONVERT_FROM_LITERAL("")); fMemberInfo.GetClientGuid()->SetAccountUUID(plUUID()); fMemberInfo.Poke(stream, peekOptions); stream->WriteByte(fAddMember); diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h index ad0d7820..937591e6 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h @@ -65,8 +65,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnNetBase/pnNetBase.h" -#include - class plMessage; class plUUID; @@ -246,11 +244,11 @@ public: void InitReplyFieldsFrom(plNetMessage * msg); // debug - virtual std::string AsStdString() const + virtual plString AsString() const { const char* delim = ""; - std::stringstream ss; + plStringStream ss; if ( GetHasPlayerID() ) { ss << delim << "p:" << GetPlayerID(); @@ -263,7 +261,7 @@ public: } if ( GetHasAcctUUID() ) { - ss << delim << "a:" << GetAcctUUID()->AsStdString(); + ss << delim << "a:" << GetAcctUUID()->AsString(); delim = ","; } if ( IsBitSet(kHasVersion) ) @@ -272,7 +270,7 @@ public: delim = ","; } - return ss.str().c_str(); + return ss.GetString(); } }; @@ -331,12 +329,10 @@ public: void WriteVersion(hsStream* s, hsResMgr* mgr); // debug - std::string AsStdString() const + plString AsString() const { - std::string s; char tmp[256]; - xtl::format(s,"object=%s, %s",fObjectHelper.GetUoid().StringIze(tmp), plNetMessage::AsStdString().c_str()); - return s; + return plString::Format("object=%s, %s",fObjectHelper.GetUoid().StringIze(tmp), plNetMessage::AsString().c_str()); } }; @@ -409,7 +405,7 @@ public: void SetIsAvatarState(bool b) { fIsAvatarState = b; } // debug - std::string AsStdString() const; + plString AsString() const; bool IsInitialState() const {return fIsInitialState!=0; } void SetIsInitialState( bool v ) { fIsInitialState=v; } @@ -509,12 +505,10 @@ public: void WriteVersion(hsStream* s, hsResMgr* mgr); // debug - std::string AsStdString() const + plString AsString() const { - std::string s; const char* noc=plFactory::GetTheFactory()->GetNameOfClass(StreamInfo()->GetStreamType()); - xtl::format(s,"%s %s",plNetMsgStream::AsStdString().c_str(), noc ? noc : "?"); - return s; + return plString::Format("%s %s",plNetMsgStream::AsString().c_str(), noc ? noc : "?"); } }; @@ -562,13 +556,11 @@ public: // debug - std::string AsStdString() const + plString AsString() const { - std::string s; char tmp[256]; - xtl::format(s,"object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze(tmp), fIsInitialState, - plNetMsgGameMessage::AsStdString().c_str()); - return s; + return plString::Format("object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze(tmp), fIsInitialState, + plNetMsgGameMessage::AsString().c_str()); } }; @@ -805,11 +797,9 @@ public: void WriteVersion(hsStream* s, hsResMgr* mgr); // debug - std::string AsStdString() const + plString AsStdString() const { - std::string s; - xtl::format(s,"lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsStdString().c_str()); - return s; + return plString::Format("lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsString().c_str()); } }; @@ -991,18 +981,16 @@ public: const hsBitVector& GetRegionsICareAbout() const { return fRegionsICareAbout; } const hsBitVector& GetRegionsImIn() const { return fRegionsImIn; } - std::string AsStdString() const + plString AsStdString() const { - std::string s; - std::string b1, b2; + plString b1, b2; int i; for(i=0;iGetClientGuid()->SetClientKey(""); + fMembers[i]->GetClientGuid()->SetClientKey(_TEMP_CONVERT_FROM_LITERAL("")); fMembers[i]->GetClientGuid()->SetAccountUUID(plUUID()); fMembers[i]->Poke(stream, peekOptions); }