mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 06:15:32 +00:00
Merge branch 'cicontent' into 'master'
Use ciEqual to detect missing content files See merge request OpenMW/openmw!3767
This commit is contained in:
commit
99164b3a0e
2 changed files with 7 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <components/loadinglistener/loadinglistener.hpp>
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
|
|
||||||
#include <components/files/conversion.hpp>
|
#include <components/files/conversion.hpp>
|
||||||
|
#include <components/misc/algorithm.hpp>
|
||||||
#include <components/settings/values.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include <osg/Image>
|
#include <osg/Image>
|
||||||
|
@ -81,10 +82,8 @@ std::map<int, int> MWState::StateManager::buildContentFileIndexMap(const ESM::ES
|
||||||
|
|
||||||
for (int iPrev = 0; iPrev < static_cast<int>(prev.size()); ++iPrev)
|
for (int iPrev = 0; iPrev < static_cast<int>(prev.size()); ++iPrev)
|
||||||
{
|
{
|
||||||
std::string id = Misc::StringUtils::lowerCase(prev[iPrev].name);
|
|
||||||
|
|
||||||
for (int iCurrent = 0; iCurrent < static_cast<int>(current.size()); ++iCurrent)
|
for (int iCurrent = 0; iCurrent < static_cast<int>(current.size()); ++iCurrent)
|
||||||
if (id == Misc::StringUtils::lowerCase(current[iCurrent]))
|
if (Misc::StringUtils::ciEqual(prev[iPrev].name, current[iCurrent]))
|
||||||
{
|
{
|
||||||
map.insert(std::make_pair(iPrev, iCurrent));
|
map.insert(std::make_pair(iPrev, iCurrent));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "esmreader.hpp"
|
#include "esmreader.hpp"
|
||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
|
#include "../misc/algorithm.hpp"
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
void SavedGame::load(ESMReader& esm)
|
void SavedGame::load(ESMReader& esm)
|
||||||
|
@ -67,7 +69,9 @@ namespace ESM
|
||||||
std::vector<std::string_view> missingFiles;
|
std::vector<std::string_view> missingFiles;
|
||||||
for (const std::string& contentFile : mContentFiles)
|
for (const std::string& contentFile : mContentFiles)
|
||||||
{
|
{
|
||||||
if (std::find(allContentFiles.begin(), allContentFiles.end(), contentFile) == allContentFiles.end())
|
auto it = std::find_if(allContentFiles.begin(), allContentFiles.end(),
|
||||||
|
[&](const std::string& file) { return Misc::StringUtils::ciEqual(file, contentFile); });
|
||||||
|
if (it == allContentFiles.end())
|
||||||
{
|
{
|
||||||
missingFiles.emplace_back(contentFile);
|
missingFiles.emplace_back(contentFile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue