Merge pull request #12860 from LillyJadeKatrin/retroachievements-progress-spam

Only Display One Progress At A Time
This commit is contained in:
JMC47 2024-06-15 02:42:04 -04:00 committed by GitHub
commit a13b198ba0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -812,11 +812,16 @@ void AchievementManager::HandleAchievementChallengeIndicatorHideEvent(
void AchievementManager::HandleAchievementProgressIndicatorShowEvent(
const rc_client_event_t* client_event)
{
const auto& instance = AchievementManager::GetInstance();
auto& instance = AchievementManager::GetInstance();
auto current_time = std::chrono::steady_clock::now();
const auto message_wait_time = std::chrono::milliseconds{OSD::Duration::SHORT};
if (current_time - instance.m_last_progress_message < message_wait_time)
return;
OSD::AddMessage(fmt::format("{} {}", client_event->achievement->title,
client_event->achievement->measured_progress),
OSD::Duration::SHORT, OSD::Color::GREEN,
&instance.GetAchievementBadge(client_event->achievement->id, false));
instance.m_last_progress_message = current_time;
}
void AchievementManager::HandleGameCompletedEvent(const rc_client_event_t* client_event,

View File

@ -201,6 +201,7 @@ private:
std::unordered_map<AchievementId, Badge> m_locked_badges;
RichPresence m_rich_presence;
std::chrono::steady_clock::time_point m_last_rp_time = std::chrono::steady_clock::now();
std::chrono::steady_clock::time_point m_last_progress_message = std::chrono::steady_clock::now();
std::unordered_map<AchievementId, LeaderboardStatus> m_leaderboard_map;
NamedBadgeMap m_active_challenges;