Exemplo n.º 1
0
void gun::HighScoreEntryScreen::EnterHighScores()
{
	ScoreEntry high_score = ScoreEntry();
	high_score.name = name_text_.string();
	high_score.score = Services::Instance().session().score;
	Services::Instance().session().high_scores.push_back(high_score);
	std::sort(Services::Instance().session().high_scores.begin(), 
		Services::Instance().session().high_scores.end(), ScoreEntryComparer());

	while ((int)Services::Instance().session().high_scores.size()
		> Services::Instance().session().MAX_HIGH_SCORES)
	{
		Services::Instance().session().high_scores.pop_back();
	}

	SaveHighScores();
	screen_mgr_->RemoveScreen(this);
	screen_mgr_->AddScreen(new HighScoresScreen(high_score));
}
Exemplo n.º 2
0
void ScoreFile::Insert(const string& name, int score)
{
   scores[9] = ScoreEntry(name.c_str(), score);
   Sort();
   needsWrite = true;
}
Exemplo n.º 3
0
ScoreFile::ScoreFile()
   : needsWrite(false), scores(NUM_SCORES, ScoreEntry("Nobody", 0))
{

}