diff --git a/apps/opencs/model/world/infocollection.cpp b/apps/opencs/model/world/infocollection.cpp index 7b7c274a09..f508b683ee 100644 --- a/apps/opencs/model/world/infocollection.cpp +++ b/apps/opencs/model/world/infocollection.cpp @@ -106,10 +106,11 @@ int CSMWorld::InfoCollection::getInfoIndex (const std::string& id, const std::st return -1; // brute force loop + std::string lowerId = Misc::StringUtils::lowerCase (id); for (std::vector >::const_iterator it = iter->second.begin(); it != iter->second.end(); ++it) { - if (Misc::StringUtils::ciEqual(it->first, id)) + if (Misc::StringUtils::cEqual(it->first, lowerId)) return it->second; } diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp index d6bc190695..1f6da37c7a 100644 --- a/components/misc/stringops.hpp +++ b/components/misc/stringops.hpp @@ -35,6 +35,20 @@ public: return true; } + static bool cEqual(const std::string &x, const std::string &y) { + if (x.size() != y.size()) { + return false; + } + std::string::const_iterator xit = x.begin(); + std::string::const_iterator yit = y.begin(); + for (; xit != x.end(); ++xit, ++yit) { + if (*xit != *yit) { + return false; + } + } + return true; + } + static int ciCompareLen(const std::string &x, const std::string &y, size_t len) { std::string::const_iterator xit = x.begin();