mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Simplify std::find
with Common::Contains
In NandPaths.cpp, the `std::initializer_list<char>` of illegal characters has been turned into a `char[]` (similar to the one in GameList.cpp). The reverse iteration in ResourcePack.cpp seemed to provide no benefits, and doing without it it seemed to have no ill effects.
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include <mz_os.h>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/Contains.h"
|
||||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
@ -181,8 +182,7 @@ bool ResourcePack::Install(const std::string& path)
|
||||
bool provided_by_other_pack = false;
|
||||
for (const auto& pack : GetHigherPriorityPacks(*this))
|
||||
{
|
||||
if (std::find(pack->GetTextures().begin(), pack->GetTextures().end(), texture) !=
|
||||
pack->GetTextures().end())
|
||||
if (Common::Contains(pack->GetTextures(), texture))
|
||||
{
|
||||
provided_by_other_pack = true;
|
||||
break;
|
||||
@ -246,9 +246,7 @@ bool ResourcePack::Uninstall(const std::string& path)
|
||||
// Check if a higher priority pack already provides a given texture, don't delete it
|
||||
for (const auto& pack : GetHigherPriorityPacks(*this))
|
||||
{
|
||||
if (::ResourcePack::IsInstalled(*pack) &&
|
||||
std::find(pack->GetTextures().begin(), pack->GetTextures().end(), texture) !=
|
||||
pack->GetTextures().end())
|
||||
if (::ResourcePack::IsInstalled(*pack) && Common::Contains(pack->GetTextures(), texture))
|
||||
{
|
||||
provided_by_other_pack = true;
|
||||
break;
|
||||
@ -261,9 +259,7 @@ bool ResourcePack::Uninstall(const std::string& path)
|
||||
// Check if a lower priority pack provides a given texture - if so, install it.
|
||||
for (auto& pack : lower)
|
||||
{
|
||||
if (::ResourcePack::IsInstalled(*pack) &&
|
||||
std::find(pack->GetTextures().rbegin(), pack->GetTextures().rend(), texture) !=
|
||||
pack->GetTextures().rend())
|
||||
if (::ResourcePack::IsInstalled(*pack) && Common::Contains(pack->GetTextures(), texture))
|
||||
{
|
||||
pack->Install(path);
|
||||
|
||||
|
Reference in New Issue
Block a user