Browse Source

Merge pull request #308 from Hoikas/display-names

Age Display Name Fixes
Branan Purvine-Riley 12 years ago
parent
commit
42c8235023
  1. 40
      Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h
  3. 4
      Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStructGlue.cpp
  4. 8
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

40
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);
}
}

4
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

4
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)

8
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());

Loading…
Cancel
Save