I have this function that is meant to draw the highscores using a class called fileHandler which manages the highscore.txt file.
For some reason which I cannot see right now, when I step through the code I notice that the values for scoreList (which contain a structure called scoreData that consist of a string and a int for the score) are changing in the introduction for the for loop.
It goes from having a empty string and a integer holding 6 to a really small integer, like when a value is uninitialized, and a string with a bad pointer.
How is this being altered?????
Code:
void menu::drawScoreBoard(void)
{
///////////////////////////DRAW THE SCORE BOARD HERE//////////////////////////////////////////////////////////////////
fileHandler scoreFile;
std::vector <dataType::scoreData *> scoreList;
std::string temp;
int count = 1;
if (scoreFile.getScore(&scoreList))
{
for (std::vector<dataType::scoreData *>::iterator it = scoreList.begin(); it < scoreList.end(); it++) //error here
{
temp = drawArea->IntToStr(count) + ") " + (*it)->initials + drawArea->IntToStr((*it)->score);
drawArea->drawMessage(temp, scoreBoardPos.x, scoreBoardPos.y +count);
count++;
}
}
}