From 5aa1e2d08d287fb66c48bd820c546ece5eb110f5 Mon Sep 17 00:00:00 2001 From: schmurger Date: Tue, 21 May 2024 10:39:21 +1000 Subject: [PATCH] Initialize user achievement stats correctly --- dll/steam_user_stats.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dll/steam_user_stats.cpp b/dll/steam_user_stats.cpp index a90785e7..c61fac4f 100644 --- a/dll/steam_user_stats.cpp +++ b/dll/steam_user_stats.cpp @@ -728,10 +728,6 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network try { std::string name = static_cast(it["name"]); sorted_achievement_names.push_back(name); - if (user_achievements.find(name) == user_achievements.end()) { - user_achievements[name]["earned"] = false; - user_achievements[name]["earned_time"] = static_cast(0); - } achievement_trigger trig; trig.name = name; @@ -740,6 +736,13 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network trig.min_value = static_cast(it["progress"]["min_val"]); trig.max_value = static_cast(it["progress"]["max_val"]); achievement_stat_trigger[stat_name].push_back(trig); + + if (user_achievements.find(name) == user_achievements.end()) { + user_achievements[name]["earned"] = false; + user_achievements[name]["earned_time"] = static_cast(0); + user_achievements[name]["progress"] = std::stof(trig.min_value); + user_achievements[name]["max_progress"] = std::stof(trig.max_value); + } } catch (...) {} try {