This commit is contained in:
Alayan 2019-04-15 17:55:48 +02:00
parent aecee4c781
commit 2779487d0b

View File

@ -101,26 +101,14 @@ void StoryModeStatus::computeActive(bool first_call)
// locks all features, so unlock the solved ones (and don't try to // locks all features, so unlock the solved ones (and don't try to
// save the state, since we are currently reading it) // save the state, since we are currently reading it)
if (i->second->isSolved(RaceManager::DIFFICULTY_EASY))
// Challenge-specific unlocked features don't depend on
// the difficulty at which the challenge has been solved.
if (i->second->isSolvedAtAnyDifficulty())
{ {
unlockFeature(i->second, RaceManager::DIFFICULTY_EASY, unlockFeature(i->second, RaceManager::DIFFICULTY_EASY,
/*save*/ false); /*save*/ false);
} }
if (i->second->isSolved(RaceManager::DIFFICULTY_MEDIUM))
{
unlockFeature(i->second, RaceManager::DIFFICULTY_MEDIUM,
/*save*/ false);
}
if (i->second->isSolved(RaceManager::DIFFICULTY_HARD))
{
unlockFeature(i->second, RaceManager::DIFFICULTY_HARD,
/*save*/ false);
}
if (i->second->isSolved(RaceManager::DIFFICULTY_BEST))
{
unlockFeature(i->second, RaceManager::DIFFICULTY_BEST,
/*save*/ false);
}
int gp_factor = i->second->isGrandPrix() ? GP_FACTOR : 1; int gp_factor = i->second->isGrandPrix() ? GP_FACTOR : 1;
@ -260,6 +248,9 @@ void StoryModeStatus::lockFeature(ChallengeStatus *challenge_status)
*/ */
void StoryModeStatus::unlockFeature(ChallengeStatus* c, RaceManager::Difficulty d, void StoryModeStatus::unlockFeature(ChallengeStatus* c, RaceManager::Difficulty d,
bool do_save) bool do_save)
{
// Special challenge-specific features are only unlocked once.
if(!c->isSolvedAtAnyDifficulty())
{ {
const unsigned int amount=(unsigned int)c->getData()->getFeatures().size(); const unsigned int amount=(unsigned int)c->getData()->getFeatures().size();
for (unsigned int n=0; n<amount; n++) for (unsigned int n=0; n<amount; n++)
@ -274,6 +265,7 @@ void StoryModeStatus::unlockFeature(ChallengeStatus* c, RaceManager::Difficulty
} }
m_locked_features.erase(p); m_locked_features.erase(p);
} }
}
// Add to list of recently unlocked features // Add to list of recently unlocked features
// if the challenge is newly completed at the current difficulty // if the challenge is newly completed at the current difficulty