diff --git a/src/GameData.cpp b/src/GameData.cpp index f72d9f9a4..908e5603a 100644 --- a/src/GameData.cpp +++ b/src/GameData.cpp @@ -14,7 +14,7 @@ const std::string GameData::xmlTagTimesPlayed = "timesplayed"; GameData::GameData(SystemData* system, std::string path, std::string name) - : mSystem(system), mPath(path), mName(name), mRating(0), mTimesPlayed(0) + : mSystem(system), mPath(path), mName(name), mRating(0.0f), mTimesPlayed(0) { } @@ -63,12 +63,12 @@ void GameData::setImagePath(const std::string & imagePath) mImagePath = imagePath; } -size_t GameData::getRating() const +float GameData::getRating() const { return mRating; } -void GameData::setRating(size_t rating) +void GameData::setRating(float rating) { mRating = rating; } diff --git a/src/GameData.h b/src/GameData.h index bd34be4ea..edcede2c2 100644 --- a/src/GameData.h +++ b/src/GameData.h @@ -34,8 +34,8 @@ public: const std::string & getImagePath() const; void setImagePath(const std::string & imagePath); - size_t getRating() const; - void setRating(size_t rating); + float getRating() const; + void setRating(float rating); size_t getTimesPlayed() const; void setTimesPlayed(size_t timesPlayed); @@ -52,7 +52,7 @@ private: //extra data std::string mDescription; std::string mImagePath; - size_t mRating; + float mRating; size_t mTimesPlayed; }; diff --git a/src/XMLReader.cpp b/src/XMLReader.cpp index 928fbd8ff..47e6527aa 100644 --- a/src/XMLReader.cpp +++ b/src/XMLReader.cpp @@ -182,7 +182,7 @@ void parseGamelist(SystemData* system) //get rating and the times played from the XML doc if(gameNode.child(GameData::xmlTagRating.c_str())) { - size_t rating; + float rating; std::istringstream(gameNode.child(GameData::xmlTagRating.c_str()).text().get()) >> rating; game->setRating(rating); } @@ -190,7 +190,7 @@ void parseGamelist(SystemData* system) { size_t timesPlayed; std::istringstream(gameNode.child(GameData::xmlTagTimesPlayed.c_str()).text().get()) >> timesPlayed; - game->setRating(timesPlayed); + game->setTimesPlayed(timesPlayed); } } else{ @@ -222,7 +222,7 @@ void addGameDataNode(pugi::xml_node & parent, const GameData * game) } //all other values are added regardless of their value pugi::xml_node ratingNode = newGame.append_child(GameData::xmlTagRating.c_str()); - ratingNode.text().set(std::to_string((unsigned long long)game->getRating()).c_str()); + ratingNode.text().set(std::to_string((long double)game->getRating()).c_str()); pugi::xml_node timesPlayedNode = newGame.append_child(GameData::xmlTagTimesPlayed.c_str()); timesPlayedNode.text().set(std::to_string((unsigned long long)game->getTimesPlayed()).c_str()); }