Game Development Reference
In-Depth Information
for (int i = 0; i < MAX_RANK; i++)
{
String Name = settings.getString("Name" + i, "...");
int Score = settings.getInt("Score" + i, 0);
m_HighScoreTable[i].SetName(Name);
m_HighScoreTable[i].SetScore(Score);
if (Score > 0)
{
m_HighScoreTable[i].SetItemValidState(true);
}
}
}
The NumberValidHighScores() function finds the number of valid high score entries in the high score
table. (See Listing 9-14.)
Listing 9-14. Finding the Number of Valid High Scores
int NumberValidHighScores()
{
int NumberValidScores = 0;
for (int i = 0; i < MAX_RANK; i++)
{
if (m_HighScoreTable[i].IsValid())
{
NumberValidScores++;
}
}
return NumberValidScores;
}
The GetLowestScore() function retrieves the lowest valid player score from the high score table
m_HighScoreTable . (See Listing 9-15.)
Listing 9-15. Getting the Lowest Score
int GetLowestScore()
{
// Get Lowest valid score
int LowestScore = 0;
int ValidScores = 0;
for (int i = 0; i < MAX_RANK; i++)
{
if (m_HighScoreTable[i].IsValid())
{
ValidScores++;
}
}
 
Search WWH ::




Custom Search