AchievementManager: Only nag user about disabled achievements when they were actually enabled before.

This commit is contained in:
Admiral H. Curtiss 2023-12-10 21:04:23 +01:00
parent db1620db42
commit 70cd0040a3
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 8 additions and 5 deletions

View File

@ -846,21 +846,24 @@ AchievementManager::RichPresence AchievementManager::GetRichPresence()
void AchievementManager::SetDisabled(bool disable) void AchievementManager::SetDisabled(bool disable)
{ {
bool previously_disabled;
{ {
std::lock_guard lg{m_lock}; std::lock_guard lg{m_lock};
previously_disabled = m_disabled;
m_disabled = disable; m_disabled = disable;
if (disable && m_is_game_loaded)
CloseGame();
} }
if (disable)
if (!previously_disabled && disable && Config::Get(Config::RA_ENABLED))
{ {
INFO_LOG_FMT(ACHIEVEMENTS, "Achievement Manager has been disabled."); INFO_LOG_FMT(ACHIEVEMENTS, "Achievement Manager has been disabled.");
OSD::AddMessage("Please close all games to re-enable achievements.", OSD::Duration::VERY_LONG, OSD::AddMessage("Please close all games to re-enable achievements.", OSD::Duration::VERY_LONG,
OSD::Color::RED); OSD::Color::RED);
CloseGame();
} }
else
{ if (previously_disabled && !disable)
INFO_LOG_FMT(ACHIEVEMENTS, "Achievement Manager has been re-enabled."); INFO_LOG_FMT(ACHIEVEMENTS, "Achievement Manager has been re-enabled.");
}
}; };
const AchievementManager::NamedIconMap& AchievementManager::GetChallengeIcons() const const AchievementManager::NamedIconMap& AchievementManager::GetChallengeIcons() const