diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp index 5b0708ec..4cdfa0b7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp @@ -178,14 +178,22 @@ void pyAgeInfoStruct::SetAgeLanguage( int32_t v ) fAgeInfo.SetAgeLanguage( v ); } -const char * pyAgeInfoStruct::GetDisplayName() const +plString pyAgeInfoStruct::GetDisplayName() const { - int32_t seq = GetAgeSequenceNumber(); - if ( seq>0 ) - fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); + const char* instance = GetAgeInstanceName(); + const char* user = GetAgeUserDefinedName(); + bool namesEqual = (stricmp(user, instance) == 0); // Ae'gura Ae'gura + + if (namesEqual) + return instance; else - fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); - return fDisplayName.c_str(); + { + int32_t seq = GetAgeSequenceNumber(); + if (seq > 0) + return plString::Format("%s (%d) %s", user, seq, instance); + else + return plString::Format("%s %s", user, instance); + } } @@ -255,12 +263,20 @@ void pyAgeInfoStructRef::SetAgeSequenceNumber( int32_t v ) fAgeInfo.SetAgeSequenceNumber( v ); } -const char * pyAgeInfoStructRef::GetDisplayName() const +plString pyAgeInfoStructRef::GetDisplayName() const { - int32_t seq = GetAgeSequenceNumber(); - if ( seq>0 ) - fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); + const char* instance = GetAgeInstanceName(); + const char* user = GetAgeUserDefinedName(); + bool namesEqual = (stricmp(user, instance) == 0); // Ae'gura Ae'gura + + if (namesEqual) + return instance; else - fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); - return fDisplayName.c_str(); + { + int32_t seq = GetAgeSequenceNumber(); + if (seq > 0) + return plString::Format("%s (%d) %s", user, seq, instance); + else + return plString::Format("%s %s", user, instance); + } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h index d28ab403..89a7d302 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h @@ -101,7 +101,7 @@ public: void SetAgeSequenceNumber( int32_t v ); int32_t GetAgeLanguage() const; void SetAgeLanguage( int32_t v ); - const char * GetDisplayName() const; + plString GetDisplayName() const; }; class pyAgeInfoStructRef @@ -142,7 +142,7 @@ public: void SetAgeInstanceGuid( const char * guid ); int32_t GetAgeSequenceNumber() const; void SetAgeSequenceNumber( int32_t v ); - const char * GetDisplayName() const; + plString GetDisplayName() const; }; #endif // pyAgeInfoStruct_h_inc diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp index 1b03f826..fad2a201 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp @@ -234,7 +234,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStruct, setAgeLanguage, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStruct, getDisplayName) { - return PyString_FromString(self->fThis->GetDisplayName()); + return PyString_FromPlString(self->fThis->GetDisplayName()); } PYTHON_START_METHODS_TABLE(ptAgeInfoStruct) @@ -410,7 +410,7 @@ PYTHON_METHOD_DEFINITION(ptAgeInfoStructRef, setAgeSequenceNumber, args) PYTHON_METHOD_DEFINITION_NOARGS(ptAgeInfoStructRef, getDisplayName) { - return PyString_FromString(self->fThis->GetDisplayName()); + return PyString_FromPlString(self->fThis->GetDisplayName()); } PYTHON_START_METHODS_TABLE(ptAgeInfoStructRef) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index a0f9bbd2..bd5651ff 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -958,7 +958,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) // set user-defined name plString title; unsigned nameLen = nc->GetPlayerName().GetSize(); - if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') + if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') title = plString::Format("%s'", nc->GetPlayerName().c_str()); else title = plString::Format("%s's", nc->GetPlayerName().c_str()); @@ -969,7 +969,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) // set description plString desc; unsigned nameLen = nc->GetPlayerName().GetSize(); - if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') + if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); else desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); @@ -997,7 +997,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) // set user-defined name plString title; unsigned nameLen = nc->GetPlayerName().GetSize(); - if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') + if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') title = plString::Format("%s'", nc->GetPlayerName().c_str()); else title = plString::Format("%s's", nc->GetPlayerName().c_str()); @@ -1009,7 +1009,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) // set description plString desc; unsigned nameLen = nc->GetPlayerName().GetSize(); - if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') + if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's') desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); else desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName());