Skip to content

Commit

Permalink
CLEANUP(contentmodel): Use ranges::find_if instead of a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
magicaldave committed Jun 23, 2024
1 parent 40aee53 commit fbdc4f4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions components/contentselector/model/contentmodel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "contentmodel.hpp"
#include "esmfile.hpp"

#include <algorithm>
#include <fstream>
#include <memory>
#include <stdexcept>
Expand Down Expand Up @@ -672,14 +673,8 @@ void ContentSelectorModel::ContentModel::setNonUserContent(const QStringList& fi
for (auto* file : mFiles)
file->setFromAnotherConfigFile(mNonUserContent.contains(file->fileName().toLower()));

int insertPosition = 0;

for (auto* file : mFiles)
{
if (!file->builtIn())
break;
++insertPosition;
}
int insertPosition
= std::ranges::find_if(mFiles, [](const EsmFile* file) { return !file->builtIn(); }) - mFiles.begin();

for (const auto& filepath : fileList)
{
Expand Down

0 comments on commit fbdc4f4

Please sign in to comment.