Removed some unnecessary functions in SystemData.

This commit is contained in:
Leon Styhre 2022-01-30 21:53:22 +01:00
parent 2d284fda6c
commit d414c3b845
2 changed files with 8 additions and 35 deletions

View file

@ -981,15 +981,6 @@ bool SystemData::createSystemDirectories()
return false; return false;
} }
const bool SystemData::isVisible() const
{
// This function doesn't make much sense at the moment; if a system does not have any
// games available, it will not be processed during startup and will as such not exist.
// In the future this function may be used for an option to hide specific systems, but
// for the time being all systems will always be visible.
return true;
}
SystemData* SystemData::getSystemByName(const std::string& systemName) SystemData* SystemData::getSystemByName(const std::string& systemName)
{ {
for (auto it : sSystemVector) { for (auto it : sSystemVector) {
@ -1002,30 +993,22 @@ SystemData* SystemData::getSystemByName(const std::string& systemName)
SystemData* SystemData::getNext() const SystemData* SystemData::getNext() const
{ {
std::vector<SystemData*>::const_iterator it = getIterator(); auto it = std::find(sSystemVector.cbegin(), sSystemVector.cend(), this);
// As we are starting in a valid gamelistview, this will ++it;
// always succeed, even if we have to come full circle. if (it == sSystemVector.cend())
do { it = sSystemVector.cbegin();
++it;
if (it == sSystemVector.cend())
it = sSystemVector.cbegin();
} while (!(*it)->isVisible());
return *it; return *it;
} }
SystemData* SystemData::getPrev() const SystemData* SystemData::getPrev() const
{ {
std::vector<SystemData*>::const_reverse_iterator it = getRevIterator(); auto it = std::find(sSystemVector.crbegin(), sSystemVector.crend(), this);
// As we are starting in a valid gamelistview, this will ++it;
// always succeed, even if we have to come full circle. if (it == sSystemVector.crend())
do { it = sSystemVector.crbegin();
++it;
if (it == sSystemVector.crend())
it = sSystemVector.crbegin();
} while (!(*it)->isVisible());
return *it; return *it;
} }

View file

@ -115,14 +115,6 @@ public:
static std::vector<SystemData*> sSystemVector; static std::vector<SystemData*> sSystemVector;
static std::unique_ptr<FindRules> sFindRules; static std::unique_ptr<FindRules> sFindRules;
std::vector<SystemData*>::const_iterator getIterator() const
{
return std::find(sSystemVector.cbegin(), sSystemVector.cend(), this);
}
std::vector<SystemData*>::const_reverse_iterator getRevIterator() const
{
return std::find(sSystemVector.crbegin(), sSystemVector.crend(), this);
}
const bool isCollection() const { return mIsCollectionSystem; } const bool isCollection() const { return mIsCollectionSystem; }
const bool isCustomCollection() const { return mIsCustomCollectionSystem; } const bool isCustomCollection() const { return mIsCustomCollectionSystem; }
const bool isGroupedCustomCollection() const { return mIsGroupedCustomCollectionSystem; } const bool isGroupedCustomCollection() const { return mIsGroupedCustomCollectionSystem; }
@ -132,8 +124,6 @@ public:
}; };
const bool isGameSystem() const { return mIsGameSystem; } const bool isGameSystem() const { return mIsGameSystem; }
const bool isVisible() const;
static SystemData* getSystemByName(const std::string& systemName); static SystemData* getSystemByName(const std::string& systemName);
SystemData* getNext() const; SystemData* getNext() const;
SystemData* getPrev() const; SystemData* getPrev() const;