mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
Removed update_achievement_progress function
This commit is contained in:
parent
6b26ca1b4c
commit
e30cc2957f
@ -605,7 +605,7 @@ Steam_User_Stats::InternalSetResult<bool> Steam_User_Stats::set_achievement_inte
|
||||
|
||||
result.notify_server = !settings->disable_sharing_stats_with_gameserver;
|
||||
|
||||
if (!settings->disable_overlay) overlay->AddAchievementNotification(it.value());
|
||||
if (!settings->disable_overlay) overlay->AddAchievementNotification(internal_name, user_achievements[internal_name]);
|
||||
|
||||
}
|
||||
} catch (...) {}
|
||||
@ -1151,10 +1151,7 @@ bool Steam_User_Stats::IndicateAchievementProgress( const char *pchName, uint32
|
||||
user_achievements[actual_ach_name]["progress"] = nCurProgress;
|
||||
user_achievements[actual_ach_name]["max_progress"] = nMaxProgress;
|
||||
save_achievements();
|
||||
if (!settings->disable_overlay) {
|
||||
overlay->AddAchievementNotification(it.value());
|
||||
overlay->update_achievement_progress(actual_ach_name, (int)nCurProgress);
|
||||
}
|
||||
if (!settings->disable_overlay) overlay->AddAchievementNotification(actual_ach_name, user_achievements[actual_ach_name]);
|
||||
} catch (...) {}
|
||||
|
||||
{
|
||||
|
@ -253,8 +253,7 @@ public:
|
||||
void FriendConnect(Friend _friend);
|
||||
void FriendDisconnect(Friend _friend);
|
||||
|
||||
void AddAchievementNotification(nlohmann::json const& ach);
|
||||
void update_achievement_progress(std::string const& ach_name, int nCurProgress);
|
||||
void AddAchievementNotification(std::string ach_name, nlohmann::json const& ach);
|
||||
};
|
||||
|
||||
#else // EMU_OVERLAY
|
||||
@ -288,8 +287,7 @@ public:
|
||||
void FriendConnect(Friend _friend) {}
|
||||
void FriendDisconnect(Friend _friend) {}
|
||||
|
||||
void AddAchievementNotification(nlohmann::json const& ach) {}
|
||||
void update_achievement_progress(std::string const& ach_name, int nCurProgress);
|
||||
void AddAchievementNotification(std::string ach_name, nlohmann::json const& ach) {}
|
||||
};
|
||||
|
||||
#endif // EMU_OVERLAY
|
||||
|
@ -380,19 +380,6 @@ void Steam_Overlay::load_achievements_data()
|
||||
|
||||
}
|
||||
|
||||
void Steam_Overlay::update_achievement_progress(std::string const& ach_name, int nCurProgress) {
|
||||
|
||||
PRINT_DEBUG_ENTRY();
|
||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||
|
||||
for (auto& ach : achievements) {
|
||||
if (ach.name == ach_name) {
|
||||
ach.progress = (float)nCurProgress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Steam_Overlay::initial_load_achievements_icons()
|
||||
{
|
||||
@ -1977,7 +1964,7 @@ void Steam_Overlay::FriendDisconnect(Friend _friend)
|
||||
}
|
||||
|
||||
// show a notification when the user unlocks an achievement
|
||||
void Steam_Overlay::AddAchievementNotification(nlohmann::json const &ach)
|
||||
void Steam_Overlay::AddAchievementNotification(std::string ach_name, nlohmann::json const &ach)
|
||||
{
|
||||
PRINT_DEBUG_ENTRY();
|
||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||
@ -1989,16 +1976,13 @@ void Steam_Overlay::AddAchievementNotification(nlohmann::json const &ach)
|
||||
// adjust the local 'is_achieved' and 'unlock_time'
|
||||
std::lock_guard<std::recursive_mutex> lock2(global_mutex);
|
||||
|
||||
std::string ach_name = ach.value("name", std::string());
|
||||
for (auto &a : achievements) {
|
||||
if (a.name == ach_name) {
|
||||
bool achieved = false;
|
||||
uint32 unlock_time = 0;
|
||||
a.achieved = ach.value("earned", false);
|
||||
a.unlock_time = ach.value("earned_time", static_cast<uint32>(0));
|
||||
a.progress = ach.value("progress", static_cast<float>(0));
|
||||
a.max_progress = ach.value("max_progress", static_cast<float>(0));
|
||||
|
||||
get_steam_client()->steam_user_stats->GetAchievementAndUnlockTime(a.name.c_str(), &achieved, &unlock_time);
|
||||
a.achieved = achieved;
|
||||
a.unlock_time = unlock_time;
|
||||
|
||||
if (achieved) {
|
||||
post_achievement_notification(a);
|
||||
notify_sound_user_achievement();
|
||||
|
Loading…
Reference in New Issue
Block a user