Updated Participant factory and FormattedName for better mem managment
This commit is contained in:
@ -150,7 +150,9 @@ int FDTFluxParticipant::GetTeammateNum() const
|
|||||||
|
|
||||||
bool FDTFluxParticipant::IsTeam() const
|
bool FDTFluxParticipant::IsTeam() const
|
||||||
{
|
{
|
||||||
return Teammate.Num() > 1;
|
UE_LOG(logDTFluxCore, Verbose, TEXT("IsTeam() -> %s, Teamate Num %i"),
|
||||||
|
Team.IsEmpty() ? TEXT("TRUE") : TEXT("FALSE"), Teammate.Num());
|
||||||
|
return !Team.IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
const TArray<FDTFluxPerson>& FDTFluxParticipant::GetTeammate() const
|
const TArray<FDTFluxPerson>& FDTFluxParticipant::GetTeammate() const
|
||||||
@ -165,13 +167,14 @@ FString FDTFluxParticipant::GetFormattedName(const int MaxChar, const FString& S
|
|||||||
{
|
{
|
||||||
return TEXT("");
|
return TEXT("");
|
||||||
}
|
}
|
||||||
FString FirstName;
|
|
||||||
FString LastName;
|
|
||||||
if (IsTeam())
|
if (IsTeam())
|
||||||
{
|
{
|
||||||
|
FString FullName;
|
||||||
|
UE_LOG(logDTFluxCore, Verbose, TEXT("Participant is a team"));
|
||||||
if (!Team.IsEmpty())
|
if (!Team.IsEmpty())
|
||||||
{
|
{
|
||||||
LastName = Team;
|
FullName = Team;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -180,19 +183,21 @@ FString FDTFluxParticipant::GetFormattedName(const int MaxChar, const FString& S
|
|||||||
{
|
{
|
||||||
Names.Add(Person.LastName);
|
Names.Add(Person.LastName);
|
||||||
}
|
}
|
||||||
LastName = FString::Join(Names, TEXT("/"));
|
FullName = FString::Join(Names, TEXT("/"));
|
||||||
}
|
}
|
||||||
}
|
FullName = FullName.ToUpper();
|
||||||
else
|
if (FullName.Len() <= MaxChar)
|
||||||
{
|
{
|
||||||
LastName = TEXT("Unknown");
|
return FullName;
|
||||||
|
}
|
||||||
|
return FullName.Left(MaxChar) + OverflowChar;
|
||||||
}
|
}
|
||||||
FString Initial;
|
FString Initial;
|
||||||
if (!FirstName.IsEmpty())
|
if (!Teammate[0].FirstName.IsEmpty())
|
||||||
{
|
{
|
||||||
Initial = FirstName.Left(1).ToUpper() + Separator;
|
Initial = Teammate[0].FirstName.Left(1).ToUpper() + Separator;
|
||||||
}
|
}
|
||||||
FString FormattedLastName = LastName.ToUpper();
|
const FString FormattedLastName = Teammate[0].LastName.ToUpper();
|
||||||
FString FullName = Initial + FormattedLastName;
|
FString FullName = Initial + FormattedLastName;
|
||||||
if (FullName.Len() <= MaxChar)
|
if (FullName.Len() <= MaxChar)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user