From a6b93694301e4fc010a2bb2e116e903f1fa49c49 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 8 Jun 2024 12:45:01 +0200 Subject: [PATCH] Allow checking if achievement category needs attention. --- profiler/src/profiler/TracyAchievements.cpp | 24 +++++++++++++++++++++ profiler/src/profiler/TracyAchievements.hpp | 1 + 2 files changed, 25 insertions(+) diff --git a/profiler/src/profiler/TracyAchievements.cpp b/profiler/src/profiler/TracyAchievements.cpp index 6ff43dec..fe2758ee 100644 --- a/profiler/src/profiler/TracyAchievements.cpp +++ b/profiler/src/profiler/TracyAchievements.cpp @@ -159,6 +159,30 @@ bool AchievementsMgr::NeedsAttention() const return false; } +bool AchievementsMgr::CategoryNeedsAttention( const char* id ) const +{ + auto c = data::AchievementCategories; + while( *c ) + { + if( strcmp( (*c)->id, id ) == 0 ) + { + for( auto& v : m_map ) + { + if( v.second.category == (*c) ) + { + auto& it = v.second.item; + if( it->unlockTime > 0 && !it->hideNew ) return true; + if( it->doneTime > 0 && !it->hideCompleted ) return true; + } + } + return false; + } + c++; + } + assert( false ); + return false; +} + void AchievementsMgr::FillMap( data::AchievementItem** items, data::AchievementCategory* category ) { while( *items ) diff --git a/profiler/src/profiler/TracyAchievements.hpp b/profiler/src/profiler/TracyAchievements.hpp index 73bd31fc..fd1102e4 100644 --- a/profiler/src/profiler/TracyAchievements.hpp +++ b/profiler/src/profiler/TracyAchievements.hpp @@ -66,6 +66,7 @@ public: void PopQueue(); bool NeedsAttention() const; + bool CategoryNeedsAttention( const char* id ) const; private: void FillMap( data::AchievementItem** items, data::AchievementCategory* category );