Add a score associated with updating the game info

This commit is contained in:
simon.kagstrom 2010-01-30 19:06:18 +00:00
parent b3a33134aa
commit 0f6cc25ae5
2 changed files with 9 additions and 1 deletions

View File

@ -34,6 +34,7 @@ GameInfo::GameInfo(const char *filename,
this->name = xstrdup(name);
this->author = xstrdup(author);
this->screenshot = image;
this->score = 0;
}
GameInfo::GameInfo(GameInfo *gi)
@ -203,17 +204,22 @@ void GameInfo::setAuthor(const char *author)
{
free((void*)this->author);
this->author = xstrdup(author);
if (strcmp(author, " ") != 0)
this->score++;
}
void GameInfo::setName(const char *name)
{
free((void*)this->name);
this->name = xstrdup(name);
if (strcmp(name, " ") != 0)
this->score++;
}
void GameInfo::setScreenshot(SDL_Surface *scr)
{
SDL_FreeSurface(this->screenshot);
this->screenshot = scr;
if (scr != NULL)
this->score++;
}

View File

@ -50,6 +50,8 @@ public:
const char *author;
const char *filename;
SDL_Surface *screenshot;
Uint16 score;
};
#endif /*__GAME_INFO_HH__ */