Merge pull request #12940 from LillyJadeKatrin/retroachievements-prior-unlock-bug

Fixed incorrect unlock information in Achievements dialog
This commit is contained in:
Admiral H. Curtiss 2024-07-18 21:11:35 +02:00 committed by GitHub
commit 3169bc913f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,7 +79,7 @@ void AchievementBox::UpdateData()
return;
const auto& badge = AchievementManager::GetInstance().GetAchievementBadge(
m_achievement->id, m_achievement->state != RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED);
m_achievement->id, !m_achievement->unlocked);
std::string_view color = AchievementManager::GRAY;
if (m_achievement->unlocked & RC_CLIENT_ACHIEVEMENT_UNLOCKED_HARDCORE)
color = AchievementManager::GOLD;
@ -92,13 +92,20 @@ void AchievementBox::UpdateData()
m_badge->setStyleSheet(
QStringLiteral("border: 4px solid %1").arg(QtUtils::FromStdString(color)));
if (m_achievement->state == RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED)
if (m_achievement->unlocked)
{
if (m_achievement->unlock_time != 0)
{
m_status->setText(
tr("Unlocked at %1")
.arg(QDateTime::fromSecsSinceEpoch(m_achievement->unlock_time).toString()));
}
else
{
m_status->setText(tr("Unlocked"));
}
}
else
{
m_status->setText(tr("Locked"));
}