Make the text keys lower-case when extracting them

I think it's safe to assume all text keys are treated in a case-insensitive
manner. So far the only known NiTextKeyExtraData records are for animation
keys, which effectively are.
actorid
Chris Robinson 12 years ago
parent 9675a6d04a
commit e44729cd43

@ -75,11 +75,6 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model
if(mTextKeys.size() > 0)
{
NifOgre::TextKeyMap::iterator keyiter;
for(keyiter = mTextKeys.begin();keyiter != mTextKeys.end();keyiter++)
std::transform(keyiter->second.begin(), keyiter->second.end(),
keyiter->second.begin(), ::tolower);
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
while(as.hasMoreElements())

@ -286,13 +286,18 @@ static TextKeyMap extractTextKeys(const Nif::NiTextKeyExtraData *tk)
std::string::size_type pos = 0;
while(pos < str.length())
{
while(pos < str.length() && ::isspace(str[pos]))
if(::isspace(str[pos]))
{
pos++;
if(pos >= str.length())
break;
continue;
}
std::string::size_type nextpos = std::min(str.find('\r', pos), str.find('\n', pos));
textkeys.insert(std::make_pair(tk->list[i].time, str.substr(pos, nextpos-pos)));
std::string result;
result.reserve(str.length());
std::transform(str.begin()+pos, str.begin()+std::min(str.length(), nextpos),
std::back_inserter(result), ::tolower);
textkeys.insert(std::make_pair(tk->list[i].time, result));
pos = nextpos;
}

Loading…
Cancel
Save