mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 14:36:39 +00:00
Get rid of some unnecessary case-insensitive compares
This commit is contained in:
parent
5c007cd527
commit
019893b5c6
2 changed files with 8 additions and 30 deletions
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include <extern/shiny/Main/Factory.hpp>
|
#include <extern/shiny/Main/Factory.hpp>
|
||||||
|
|
||||||
|
#include <components/nif/node.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
#include <components/nifoverrides/nifoverrides.hpp>
|
#include <components/nifoverrides/nifoverrides.hpp>
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ struct KeyTimeSort
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::map<std::string,NIFSkeletonLoader,ciLessBoost> LoaderMap;
|
typedef std::map<std::string,NIFSkeletonLoader> LoaderMap;
|
||||||
static LoaderMap sLoaders;
|
static LoaderMap sLoaders;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -918,7 +919,7 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef std::map<std::string,NIFMeshLoader,ciLessBoost> LoaderMap;
|
typedef std::map<std::string,NIFMeshLoader> LoaderMap;
|
||||||
static LoaderMap sLoaders;
|
static LoaderMap sLoaders;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1101,13 +1102,6 @@ EntityList NIFLoader::createEntities(Ogre::SceneNode *parent, TextKeyMap *textke
|
||||||
return entitylist;
|
return entitylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct checklow {
|
|
||||||
bool operator()(const char &a, const char &b) const
|
|
||||||
{
|
|
||||||
return ::tolower(a) == ::tolower(b);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EntityList NIFLoader::createEntities(Ogre::Entity *parent, const std::string &bonename,
|
EntityList NIFLoader::createEntities(Ogre::Entity *parent, const std::string &bonename,
|
||||||
Ogre::SceneNode *parentNode,
|
Ogre::SceneNode *parentNode,
|
||||||
const std::string &name,
|
const std::string &name,
|
||||||
|
@ -1120,18 +1114,19 @@ EntityList NIFLoader::createEntities(Ogre::Entity *parent, const std::string &bo
|
||||||
return entitylist;
|
return entitylist;
|
||||||
|
|
||||||
Ogre::SceneManager *sceneMgr = parentNode->getCreator();
|
Ogre::SceneManager *sceneMgr = parentNode->getCreator();
|
||||||
std::string filter = "Tri "+bonename;
|
std::string filter = "tri "+bonename;
|
||||||
|
std::transform(filter.begin()+4, filter.end(), filter.begin()+4, ::tolower);
|
||||||
for(size_t i = 0;i < meshes.size();i++)
|
for(size_t i = 0;i < meshes.size();i++)
|
||||||
{
|
{
|
||||||
Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].first->getName());
|
Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].first->getName());
|
||||||
if(ent->hasSkeleton())
|
if(ent->hasSkeleton())
|
||||||
{
|
{
|
||||||
|
std::transform(meshes[i].second.begin(), meshes[i].second.end(), meshes[i].second.begin(), ::tolower);
|
||||||
|
|
||||||
if(meshes[i].second.length() < filter.length() ||
|
if(meshes[i].second.length() < filter.length() ||
|
||||||
std::mismatch(filter.begin(), filter.end(), meshes[i].second.begin(), checklow()).first != filter.end())
|
meshes[i].second.compare(0, filter.length(), filter) != 0)
|
||||||
{
|
{
|
||||||
sceneMgr->destroyEntity(ent);
|
sceneMgr->destroyEntity(ent);
|
||||||
meshes.erase(meshes.begin()+i);
|
|
||||||
i--;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!entitylist.mSkelBase)
|
if(!entitylist.mSkelBase)
|
||||||
|
|
|
@ -30,23 +30,6 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
|
||||||
#include "../nif/node.hpp"
|
|
||||||
|
|
||||||
#include <libs/platform/strings.h>
|
|
||||||
|
|
||||||
class BoundsFinder;
|
|
||||||
|
|
||||||
struct ciLessBoost : std::binary_function<std::string, std::string, bool>
|
|
||||||
{
|
|
||||||
bool operator() (const std::string & s1, const std::string & s2) const
|
|
||||||
{
|
|
||||||
//case insensitive version of is_less
|
|
||||||
return boost::algorithm::lexicographical_compare(s1, s2, boost::algorithm::is_iless());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Nif
|
namespace Nif
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue