diff --git a/Source/DTFluxCoreSubsystem/Private/DTFluxCoreSubsystem.cpp b/Source/DTFluxCoreSubsystem/Private/DTFluxCoreSubsystem.cpp index f3d9a8c..a4e3fe3 100644 --- a/Source/DTFluxCoreSubsystem/Private/DTFluxCoreSubsystem.cpp +++ b/Source/DTFluxCoreSubsystem/Private/DTFluxCoreSubsystem.cpp @@ -263,6 +263,15 @@ void UDTFluxCoreSubsystem::RequestAllSplitRankingOfStage(int InContestId, int In // TODO Implement this } +const FDTFluxParticipant UDTFluxCoreSubsystem::GetParticipant(int InBib) +{ + if (DataStorage->Participants.Contains(InBib)) + { + return DataStorage->Participants[InBib]; + } + return FDTFluxParticipant(); +} + void UDTFluxCoreSubsystem::RefreshStorage() { // TODO Implement this @@ -293,6 +302,20 @@ TArray UDTFluxCoreSubsystem::GetContestsIdForTime(const FDateTime Time) return Contests; } +bool UDTFluxCoreSubsystem::GetContestForId(const int Id, FDTFluxContest& OutContest) +{ + for (auto KeyPair : DataStorage->Contests) + { + if (KeyPair.Value.ContestId == Id) + { + OutContest = KeyPair.Value; + return true; + } + } + UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Cannot find Contest for Id [%i]"), Id); + return false; +} + TArray UDTFluxCoreSubsystem::GetContestsForTime(const FDateTime Time) { TArray Contests; diff --git a/Source/DTFluxCoreSubsystem/Public/DTFluxCoreSubsystem.h b/Source/DTFluxCoreSubsystem/Public/DTFluxCoreSubsystem.h index 124e02a..2ff4b80 100644 --- a/Source/DTFluxCoreSubsystem/Public/DTFluxCoreSubsystem.h +++ b/Source/DTFluxCoreSubsystem/Public/DTFluxCoreSubsystem.h @@ -85,6 +85,9 @@ public: UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") void RequestAllSplitRankingOfStage(int InContestId, int InStageId, int InSplitId); + UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") + const FDTFluxParticipant GetParticipant(int InBib); + UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") void RefreshStorage(); @@ -95,6 +98,8 @@ public: UFUNCTION() TArray GetContestsIdForTime(const FDateTime Time); UFUNCTION() + bool GetContestForId(const int Id, FDTFluxContest& OutContest); + UFUNCTION() TArray GetContestsForTime(const FDateTime Time); UFUNCTION()