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

View File

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