Properly initialize user_achievements so functions like

getachievementandunlocktime work properly.
This commit is contained in:
Mr_Goldberg 2021-02-28 19:26:29 -05:00
parent 58a57cc91b
commit 992e5c3faa
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -94,6 +94,16 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa
{ {
load_achievements_db(); // achievements db load_achievements_db(); // achievements db
load_achievements(); // achievements per user load_achievements(); // achievements per user
for (auto & it : defined_achievements) {
try {
std::string name = static_cast<std::string const&>(it["name"]);
if (user_achievements.find(name) == user_achievements.end()) {
user_achievements[name]["earned"] = false;
user_achievements[name]["earned_time"] = static_cast<uint32>(0);
}
} catch (...) {}
}
} }
// Ask the server to send down this user's data and achievements for this game // Ask the server to send down this user's data and achievements for this game