From 992e5c3faabb2616f3039c4f0301552da89a4fb6 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Sun, 28 Feb 2021 19:26:29 -0500 Subject: [PATCH] Properly initialize user_achievements so functions like getachievementandunlocktime work properly. --- dll/steam_user_stats.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dll/steam_user_stats.h b/dll/steam_user_stats.h index 8766980..ddfb14e 100644 --- a/dll/steam_user_stats.h +++ b/dll/steam_user_stats.h @@ -94,6 +94,16 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa { load_achievements_db(); // achievements db load_achievements(); // achievements per user + + for (auto & it : defined_achievements) { + try { + std::string name = static_cast(it["name"]); + if (user_achievements.find(name) == user_achievements.end()) { + user_achievements[name]["earned"] = false; + user_achievements[name]["earned_time"] = static_cast(0); + } + } catch (...) {} + } } // Ask the server to send down this user's data and achievements for this game