mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Refactored GameData to be completely independent of SystemData.
This commit is contained in:
parent
c5d772657b
commit
cfd63c74db
|
@ -5,8 +5,8 @@
|
|||
#include <ctime>
|
||||
#include <sstream>
|
||||
|
||||
GameData::GameData(SystemData* system, std::string path)
|
||||
: mSystem(system), mPath(path), mBaseName(boost::filesystem::path(path).stem().string()), mMetaData(system->getGameMDD())
|
||||
GameData::GameData(const std::string& path, const MetaDataList& metadata)
|
||||
: mPath(path), mBaseName(boost::filesystem::path(path).stem().string()), mMetaData(metadata)
|
||||
{
|
||||
if(mMetaData.get("name").empty())
|
||||
mMetaData.set("name", mBaseName);
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
#include <string>
|
||||
|
||||
#include "FileData.h"
|
||||
#include "SystemData.h"
|
||||
#include "MetaData.h"
|
||||
|
||||
//This class holds information about a game: at the least, its name, system, and path. Additional information is optional and read by other classes.
|
||||
class GameData : public FileData
|
||||
{
|
||||
public:
|
||||
GameData(SystemData* system, std::string path);
|
||||
GameData(const std::string& path, const MetaDataList& metadata);
|
||||
|
||||
const std::string& getName() const override;
|
||||
const std::string& getPath() const override;
|
||||
|
@ -28,18 +27,9 @@ public:
|
|||
MetaDataList* metadata();
|
||||
|
||||
private:
|
||||
SystemData* mSystem;
|
||||
const std::string mPath;
|
||||
const std::string mBaseName;
|
||||
|
||||
//extra data
|
||||
/*std::string mDescription;
|
||||
std::string mImagePath;
|
||||
float mRating;
|
||||
float mUserRating;
|
||||
size_t mTimesPlayed;
|
||||
std::time_t mLastPlayed;*/
|
||||
|
||||
MetaDataList mMetaData;
|
||||
};
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ void SystemData::populateFolder(FolderData* folder)
|
|||
//if it matches, add it
|
||||
if(chkExt == extension)
|
||||
{
|
||||
GameData* newGame = new GameData(this, filePath.generic_string());
|
||||
GameData* newGame = new GameData(filePath.generic_string(), MetaDataList(getGameMDD()));
|
||||
folder->pushFileData(newGame);
|
||||
isGame = true;
|
||||
break;
|
||||
|
|
|
@ -90,7 +90,7 @@ GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
|
|||
loops++;
|
||||
}
|
||||
|
||||
GameData* game = new GameData(system, gameAbsPath);
|
||||
GameData* game = new GameData(gameAbsPath, MetaDataList(system->getGameMDD()));
|
||||
folder->pushFileData(game);
|
||||
return game;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue