mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-09 17:49:01 +00: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:
parent
6f10acea3f
commit
110d32729e
16 changed files with 43 additions and 51 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue