Steam returns true even if the achievement is already set

merge-requests/24/head
Nemirtingas 2019-10-11 16:08:46 +02:00
parent c60a763f68
commit f15b2b0458
1 changed files with 5 additions and 3 deletions

View File

@ -249,9 +249,11 @@ bool SetAchievement( const char *pchName )
auto it = std::find_if(defined_achievements.begin(), defined_achievements.end(), [pchName](nlohmann::json& item) {
return item["name"].get<std::string>() == pchName;
});
if (it != defined_achievements.end() && user_achievements[pchName]["earned"] == false) {
user_achievements[pchName]["earned"] = true;
user_achievements[pchName]["earned_time"] = static_cast<uint32>(std::time(nullptr));
if (it != defined_achievements.end()) {
if (user_achievements[pchName]["earned"] == false) {
user_achievements[pchName]["earned"] = true;
user_achievements[pchName]["earned_time"] = static_cast<uint32>(std::time(nullptr));
}
return true;
}
} catch (...) {}