don't allow achievement trigger to propagate its error to next lines, this allows ahievements to be initialzied properly

This commit is contained in:
otavepto 2024-06-07 19:56:35 +03:00
parent f7c7d79e0a
commit 06189e303f

View File

@ -730,13 +730,15 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network
std::string name = static_cast<std::string const&>(it["name"]);
sorted_achievement_names.push_back(name);
achievement_trigger trig;
achievement_trigger trig{};
try {
trig.name = name;
trig.value_operation = static_cast<std::string const&>(it["progress"]["value"]["operation"]);
std::string stat_name = common_helpers::ascii_to_lowercase(static_cast<std::string const&>(it["progress"]["value"]["operand1"]));
trig.min_value = static_cast<std::string const&>(it["progress"]["min_val"]);
trig.max_value = static_cast<std::string const&>(it["progress"]["max_val"]);
achievement_stat_trigger[stat_name].push_back(trig);
} catch(...) {}
if (user_achievements.find(name) == user_achievements.end()) {
user_achievements[name]["earned"] = false;