mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Process unlock list, unlock achievement categories.
This commit is contained in:
parent
fde874eedf
commit
7401a72ccf
@ -57,6 +57,23 @@ AchievementsMgr::AchievementsMgr()
|
||||
c++;
|
||||
}
|
||||
}
|
||||
c = it->unlocks;
|
||||
if( c )
|
||||
{
|
||||
while( *c )
|
||||
{
|
||||
if( (*c)->unlockTime == 0 ) (*c)->unlockTime = it->doneTime;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( auto& v : m_map )
|
||||
{
|
||||
if( v.second.category->unlockTime == 0 && v.second.item->unlockTime > 0 )
|
||||
{
|
||||
v.second.category->unlockTime = v.second.item->unlockTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,19 +103,32 @@ void AchievementsMgr::Achieve( const char* id )
|
||||
{
|
||||
auto it = m_map.find( id );
|
||||
assert( it != m_map.end() );
|
||||
if( it->second.item->unlockTime == 0 ) return;
|
||||
if( it->second.item->doneTime > 0 ) return;
|
||||
auto& a = *it->second.item;
|
||||
|
||||
if( a.unlockTime == 0 ) return;
|
||||
if( a.doneTime > 0 ) return;
|
||||
|
||||
const auto t = uint64_t( time( nullptr ) );
|
||||
|
||||
it->second.item->doneTime = uint64_t( t );
|
||||
m_queue.push_back( it->second.item );
|
||||
a.doneTime = uint64_t( t );
|
||||
m_queue.push_back( &a );
|
||||
|
||||
auto c = it->second.item->items;
|
||||
auto c = a.items;
|
||||
if( c )
|
||||
{
|
||||
while( *c ) (*c++)->unlockTime = t;
|
||||
}
|
||||
c = a.unlocks;
|
||||
if( c )
|
||||
{
|
||||
while( *c )
|
||||
{
|
||||
(*c)->unlockTime = t;
|
||||
auto cit = m_map.find( (*c)->id );
|
||||
if( cit->second.category->unlockTime == 0 ) cit->second.category->unlockTime = t;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data::AchievementCategory** AchievementsMgr::GetCategories() const
|
||||
|
Loading…
Reference in New Issue
Block a user