From 0f6cc25ae5fd01fc5a1d7ca96b9004ef85c5cb09 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 30 Jan 2010 19:06:18 +0000 Subject: [PATCH] Add a score associated with updating the game info --- Src/gui/game_info.cpp | 8 +++++++- Src/gui/game_info.hh | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Src/gui/game_info.cpp b/Src/gui/game_info.cpp index 3fb3838..497ac83 100644 --- a/Src/gui/game_info.cpp +++ b/Src/gui/game_info.cpp @@ -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++; } diff --git a/Src/gui/game_info.hh b/Src/gui/game_info.hh index 0a6d855..731a7b2 100644 --- a/Src/gui/game_info.hh +++ b/Src/gui/game_info.hh @@ -50,6 +50,8 @@ public: const char *author; const char *filename; SDL_Surface *screenshot; + + Uint16 score; }; #endif /*__GAME_INFO_HH__ */