Fix achievement unlock propagation.

Achieve() now propagates a category unlock to the category's remaining
items, matching the constructor's load-time behavior. This lets an
achievement complete in the session where its category first unlocks.
This commit is contained in:
Bartosz Taudul
2026-10-06 00:40:25 +02:00
parent 23755c9fc8
commit c4683bdf38

View File

@@ -126,7 +126,15 @@ void AchievementsMgr::Achieve( const char* id )
{
(*c)->unlockTime = t;
auto cit = m_map.find( (*c)->id );
if( cit->second.category->unlockTime == 0 ) cit->second.category->unlockTime = t;
assert( cit != m_map.end() );
auto& cat = *cit->second.category;
if( cat.unlockTime == 0 ) cat.unlockTime = t;
auto items = cat.items;
while( *items )
{
if( (*items)->unlockTime == 0 ) (*items)->unlockTime = cat.unlockTime;
items++;
}
c++;
}
}