Esempio n. 1
0
void UpdateHighscore(const unsigned int score, ResourceManager &resourceManager)
{
    std::vector<Scores> scoreVec;
    if(GetScores(scoreVec))
    {
        bool highscore(false);
        auto where(scoreVec.begin());
        for(; where != scoreVec.end() && !highscore; ++where)
        {
            if(score > (*where).score)
            {
                highscore = true;
            }
        }
        if(highscore)
        {
            Scores scores;
            scores.name = GetName(resourceManager);
            scores.score = score;
            scoreVec.push_back(scores);
            std::sort(scoreVec.begin(), scoreVec.end(), SortByScore);
            scoreVec.erase(scoreVec.end() - 1);

            WriteHighscore(scoreVec);
        }
        scoreVec.clear();
    }
}
Esempio n. 2
0
void Highscore::Shutdown()
{
	WriteHighscore();
	Instance = NULL; 
}