diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 4358c4094e..631ef9a112 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -81,10 +82,8 @@ std::map MWState::StateManager::buildContentFileIndexMap(const ESM::ES for (int iPrev = 0; iPrev < static_cast(prev.size()); ++iPrev) { - std::string id = Misc::StringUtils::lowerCase(prev[iPrev].name); - for (int iCurrent = 0; iCurrent < static_cast(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)); break; diff --git a/components/esm3/savedgame.cpp b/components/esm3/savedgame.cpp index 3ffe062d76..0dc1fb0653 100644 --- a/components/esm3/savedgame.cpp +++ b/components/esm3/savedgame.cpp @@ -3,6 +3,8 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "../misc/algorithm.hpp" + namespace ESM { void SavedGame::load(ESMReader& esm) @@ -67,7 +69,9 @@ namespace ESM std::vector missingFiles; 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); }