mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-26 10:24:14 +08:00
don't allow achievement trigger to propagate its error to next lines, this allows ahievements to be initialzied properly
This commit is contained in:
parent
f7c7d79e0a
commit
06189e303f
@ -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"]);
|
std::string name = static_cast<std::string const&>(it["name"]);
|
||||||
sorted_achievement_names.push_back(name);
|
sorted_achievement_names.push_back(name);
|
||||||
|
|
||||||
achievement_trigger trig;
|
achievement_trigger trig{};
|
||||||
|
try {
|
||||||
trig.name = name;
|
trig.name = name;
|
||||||
trig.value_operation = static_cast<std::string const&>(it["progress"]["value"]["operation"]);
|
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"]));
|
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.min_value = static_cast<std::string const&>(it["progress"]["min_val"]);
|
||||||
trig.max_value = static_cast<std::string const&>(it["progress"]["max_val"]);
|
trig.max_value = static_cast<std::string const&>(it["progress"]["max_val"]);
|
||||||
achievement_stat_trigger[stat_name].push_back(trig);
|
achievement_stat_trigger[stat_name].push_back(trig);
|
||||||
|
} catch(...) {}
|
||||||
|
|
||||||
if (user_achievements.find(name) == user_achievements.end()) {
|
if (user_achievements.find(name) == user_achievements.end()) {
|
||||||
user_achievements[name]["earned"] = false;
|
user_achievements[name]["earned"] = false;
|
||||||
@ -744,11 +746,11 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network
|
|||||||
user_achievements[name]["progress"] = std::stoi(trig.min_value);
|
user_achievements[name]["progress"] = std::stoi(trig.min_value);
|
||||||
user_achievements[name]["max_progress"] = std::stoi(trig.max_value);
|
user_achievements[name]["max_progress"] = std::stoi(trig.max_value);
|
||||||
}
|
}
|
||||||
} catch (...) {}
|
} catch(...) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
it["hidden"] = std::to_string(it["hidden"].get<int>());
|
it["hidden"] = std::to_string(it["hidden"].get<int>());
|
||||||
} catch (...) {}
|
} catch(...) {}
|
||||||
|
|
||||||
it["displayName"] = get_value_for_language(it, "displayName", settings->get_language());
|
it["displayName"] = get_value_for_language(it, "displayName", settings->get_language());
|
||||||
it["description"] = get_value_for_language(it, "description", settings->get_language());
|
it["description"] = get_value_for_language(it, "description", settings->get_language());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user