Allow checking if achievement category needs attention.

This commit is contained in:
Bartosz Taudul 2024-06-08 12:45:01 +02:00
parent 7401a72ccf
commit a6b9369430
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 25 additions and 0 deletions

View File

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

View File

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