Added Pursuit functionality (Untested and not fully implemented) + Global TrackedRequestSending check
This commit is contained in:
@ -6,24 +6,6 @@
|
||||
void FDTFluxContestRanking::Dump() const
|
||||
{
|
||||
UE_LOG(logDTFluxCore, Log,
|
||||
TEXT("FDTFluxContestRanking ->> \n \"rank\" : %d, Participant with Bib %d \"Gap\" : %s, \"Time\" : %s "),
|
||||
Rank, Bib, *Gap, *Time );
|
||||
TEXT("FDTFluxContestRanking ->> \n \"rank\" : %d, Participant with Bib %d \"Gap\" : %s, \"Time\" : %s "),
|
||||
Rank, Bib, *Gap, *Time);
|
||||
};
|
||||
|
||||
// void FDTFluxStageRanking::Dump() const
|
||||
// {
|
||||
// UE_LOG(logDTFluxCore, Log, TEXT("RANKING : %02d. Participant bib %d %s %s %s %s %s"),
|
||||
// Rank, Bib, *Gap, *TimeSwim,
|
||||
// *TimeTransition, *TimeRun, *StartTime.ToString());
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
|
||||
// void FDTFluxSplitRanking::Dump() const
|
||||
// {
|
||||
// UE_LOG(logDTFluxCore, Log, TEXT("SplitGapItem"))
|
||||
// // Participant.Dump();
|
||||
// UE_LOG(logDTFluxCore, Log, TEXT("Bib %02d Rank %02d Gap %s Time %s"), Bib, Rank, *Gap, *Time);
|
||||
// }
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "Types/Struct/DTFluxTeamListStruct.h"
|
||||
|
||||
#include "DTFluxCoreModule.h"
|
||||
|
||||
|
||||
void FDTFluxParticipant::AddTeammate(const FDTFluxPerson& Person)
|
||||
{
|
||||
@ -15,78 +17,67 @@ void FDTFluxParticipant::AddTeammate(const FString LastName, const FString First
|
||||
|
||||
FString FDTFluxParticipant::GetFormattedName(const int MaxChar, const FString OverflowChars) const
|
||||
{
|
||||
// Vérifie les cas limites
|
||||
if (MaxChar <= 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
FString FirstName;
|
||||
FString LastName;
|
||||
if (IsTeam())
|
||||
{
|
||||
LastName = Team;
|
||||
}
|
||||
else
|
||||
{
|
||||
FirstName = Teammate[0].FirstName;
|
||||
LastName = Teammate[0].LastName;
|
||||
}
|
||||
// Récupère la première lettre du prénom en majuscule
|
||||
FString Initial;
|
||||
if (!FirstName.IsEmpty())
|
||||
{
|
||||
Initial = FirstName.Left(1).ToUpper() + " ";
|
||||
}
|
||||
|
||||
// Nom complet en majuscules
|
||||
FString FormattedLastName = LastName.ToUpper();
|
||||
|
||||
// Construction du nom final
|
||||
FString FullName = Initial + FormattedLastName;
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("FullName for Bib %i is %s"), Bib, *FullName);
|
||||
|
||||
// Tronque si nécessaire
|
||||
if (FullName.Len() > MaxChar)
|
||||
{
|
||||
// On essaie de garder autant de caractères que possible
|
||||
const int32 AvailableLength = MaxChar - Initial.Len();
|
||||
if (AvailableLength <= 0)
|
||||
if (MaxChar <= 0)
|
||||
{
|
||||
return Initial;
|
||||
return "";
|
||||
}
|
||||
|
||||
// Coupe le nom pour qu’il rentre dans la limite
|
||||
const int32 TruncateLength = FMath::Min(AvailableLength, FormattedLastName.Len());
|
||||
FullName = Initial + FormattedLastName.Left(TruncateLength);
|
||||
|
||||
// Si on a coupé trop court, on ajoute le suffixe
|
||||
if (FormattedLastName.Len() > TruncateLength)
|
||||
FString FirstName;
|
||||
FString LastName;
|
||||
if (IsTeam())
|
||||
{
|
||||
// On vérifie qu'il reste de la place pour le suffixe
|
||||
const int32 CurrentLength = FullName.Len();
|
||||
const int32 OverflowLength = OverflowChars.Len();
|
||||
|
||||
if (CurrentLength + OverflowLength <= MaxChar)
|
||||
{
|
||||
FullName += OverflowChars;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Il faut tronquer davantage pour faire de la place au suffixe
|
||||
const int32 RemainingSpace = MaxChar - CurrentLength;
|
||||
if (RemainingSpace > 0)
|
||||
{
|
||||
FullName = FullName.Left(MaxChar - OverflowLength) + OverflowChars;
|
||||
}
|
||||
else
|
||||
{
|
||||
FullName = FullName.Left(MaxChar);
|
||||
}
|
||||
}
|
||||
LastName = Team;
|
||||
}
|
||||
else
|
||||
{
|
||||
FirstName = Teammate[0].FirstName;
|
||||
LastName = Teammate[0].LastName;
|
||||
}
|
||||
FString Initial;
|
||||
if (!FirstName.IsEmpty())
|
||||
{
|
||||
Initial = FirstName.Left(1).ToUpper() + " ";
|
||||
}
|
||||
}
|
||||
|
||||
return FullName;
|
||||
FString FormattedLastName = LastName.ToUpper();
|
||||
|
||||
FString FullName = Initial + FormattedLastName;
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("FullName for Bib %i is %s"), Bib, *FullName);
|
||||
|
||||
if (FullName.Len() <= MaxChar)
|
||||
{
|
||||
return FullName;
|
||||
}
|
||||
|
||||
const int32 OverflowLength = OverflowChars.Len();
|
||||
|
||||
if (OverflowLength > MaxChar)
|
||||
{
|
||||
return FullName.Left(MaxChar);
|
||||
}
|
||||
|
||||
if (Initial.Len() + OverflowLength > MaxChar)
|
||||
{
|
||||
return FullName.Left(MaxChar);
|
||||
}
|
||||
|
||||
const int32 AvailableForLastName = MaxChar - Initial.Len() - OverflowLength;
|
||||
|
||||
if (AvailableForLastName <= 0)
|
||||
{
|
||||
return FullName.Left(MaxChar);
|
||||
}
|
||||
|
||||
FString TruncatedName = Initial + FormattedLastName.Left(AvailableForLastName) + OverflowChars;
|
||||
|
||||
if (TruncatedName.Len() > MaxChar)
|
||||
{
|
||||
return TruncatedName.Left(MaxChar);
|
||||
}
|
||||
|
||||
return TruncatedName;
|
||||
}
|
||||
}
|
||||
|
||||
FString FDTFluxParticipant::GetConcatFormattedName(const int MaxChar, const FString OverflowChar) const
|
||||
|
||||
Reference in New Issue
Block a user