mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
in Steam_User_Stats::ResetAllStats()
reset progress
only if it was defined in the original schema
This commit is contained in:
parent
6bf45a35e2
commit
ace1a591e5
@ -1391,8 +1391,23 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo )
|
||||
|
||||
item["earned"] = false;
|
||||
item["earned_time"] = static_cast<uint32>(0);
|
||||
item["progress"] = static_cast<uint32>(0);
|
||||
|
||||
try {
|
||||
auto defined_ach_it = defined_achievements_find(name);
|
||||
if (defined_achievements.end() != defined_ach_it) {
|
||||
auto defined_progress_it = defined_ach_it->find("progress");
|
||||
if (defined_ach_it->end() != defined_progress_it) { // if the schema had "progress"
|
||||
uint32 val = 0;
|
||||
try {
|
||||
auto defined_min_val = defined_progress_it->value("min_val", std::string("0"));
|
||||
val = std::stoul(defined_min_val);
|
||||
} catch(...){}
|
||||
item["progress"] = val;
|
||||
}
|
||||
}
|
||||
}catch(...){}
|
||||
|
||||
// this won't actually trigger a notification, just updates the data
|
||||
overlay->AddAchievementNotification(name, item, false);
|
||||
} catch(const std::exception& e) {
|
||||
PRINT_DEBUG("ERROR: %s", e.what());
|
||||
|
Loading…
Reference in New Issue
Block a user