Added Pursuit functionality (Untested and not fully implemented) + Global TrackedRequestSending check

This commit is contained in:
2025-07-09 03:27:23 +02:00
parent 8f884f6224
commit 03eb1132ef
22 changed files with 636 additions and 294 deletions

View File

@ -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);
// }

View File

@ -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 quil 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

View File

@ -85,11 +85,11 @@ public:
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Model", VisibleAnywhere)
FDateTime StartTime;
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Model", VisibleAnywhere)
float SpeedRunning;
FString SpeedRunning;
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Model", VisibleAnywhere)
float SpeedTotal;
FString SpeedTotal;
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Model", VisibleAnywhere)
float SpeedSwim;
FString SpeedSwim;
void Dump() const;
};
@ -103,6 +103,7 @@ public:
int ContestId = -1;
UPROPERTY(BlueprintReadWrite, Category="DTFlux|Model|Ranking", VisibleAnywhere)
int StageId = -1;
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Model|Ranking", VisibleAnywhere)
TArray<FDTFluxDetailedRankingItem> Rankings;
};

View File

@ -32,4 +32,7 @@ struct FDTFluxPursuitInfo
//TODO : Set this property to BlueprintReadOnly
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FDateTime StartTime;
UPROPERTY()
int ContestId = -1;
};